@@ -57,14 +57,13 @@ def __init__(self,is_training):
5757 "output_weights%s" % str (i ), [2 , hidden_size ],
5858 initializer = tf .truncated_normal_initializer (stddev = 0.02 ))
5959 output_bias = tf .get_variable (
60- "output_bias%s" % str (i ), [2 ], initializer = tf .zeros_initializer ())#
61- logits = tf .matmul (output_layer , output_weights , transpose_b = True )
62- logits = tf .nn .bias_add (logits , output_bias )
60+ "output_bias%s" % str (i ), [2 ], initializer = tf .zeros_initializer ())
61+ logits = tf .nn .bias_add (tf .matmul (output_layer , output_weights , transpose_b = True ), output_bias )
6362 logits_num_label .append (logits )
6463 one_hot_labels = tf .one_hot (self .label_ids [:,i ], depth = 2 , dtype = tf .int32 )
6564 per_example_loss = tf .nn .softmax_cross_entropy_with_logits (labels = one_hot_labels ,logits = logits )
6665 loss_num_label .append (tf .reduce_mean (per_example_loss ))
67- self .logits_num_label = tf .reshape (tf .stack (logits_num_label , 0 ), [ - 1 , hp . num_labels , 2 ])
66+ self .logits_num_label = tf .transpose (tf .stack (logits_num_label , 0 ),[ 1 , 0 , 2 ])
6867 self .loss_num_label = tf .stack (loss_num_label , 0 )
6968 self .probabilities = tf .nn .sigmoid (self .logits_num_label )
7069
0 commit comments