d41aa4d2c995796e3978a83052515572f402fa5f,basic/model.py,Model,_build_loss,#Model#,219

Before Change


        loss_mask = tf.reduce_max(tf.cast(self.q_mask, "float"), 1)
        if config.wy:
            losses = tf.nn.sigmoid_cross_entropy_with_logits(
                tf.reshape(self.logits2, [-1, M, JX]), tf.cast(self.wy, "float"))  // [N, M, JX]
            num_pos = tf.reduce_sum(tf.cast(self.wy, "float"))
            num_neg = tf.reduce_sum(tf.cast(self.x_mask, "float")) - num_pos
            damp_ratio = num_pos / num_neg

After Change



        loss_mask = tf.reduce_max(tf.cast(self.q_mask, "float"), 1)
        if config.wy:
            if config.na:
                na = tf.reshape(self.na, [-1, 1])
                concat_y = tf.concat(1, [na, tf.reshape(self.wy, [-1, M * JX])])
                losses = tf.nn.softmax_cross_entropy_with_logits(self.concat_logits, tf.cast(concat_y, "float"))
            else:
                losses = tf.nn.softmax_cross_entropy_with_logits(
                    self.logits2, tf.cast(tf.reshape(self.wy, [-1, M * JX]), "float"))
            ce_loss = tf.reduce_mean(loss_mask * losses)
            tf.add_to_collection("losses", ce_loss)

        else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: wenwei202/iss-rnns
Commit Name: d41aa4d2c995796e3978a83052515572f402fa5f
Time: 2017-01-21
Author: seominjoon@gmail.com
File Name: basic/model.py
Class Name: Model
Method Name: _build_loss


Project Name: explosion/thinc
Commit Name: 3c7d4d1240103e4c06a0110b00e11b7e1002dd0e
Time: 2020-01-12
Author: honnibal+gh@gmail.com
File Name: thinc/layers/lstm.py
Class Name:
Method Name: LSTM


Project Name: explosion/thinc
Commit Name: 6d506202920745291cc89d1e31de62ddcc3e375a
Time: 2020-01-12
Author: honnibal+gh@gmail.com
File Name: thinc/layers/lstm.py
Class Name:
Method Name: LSTM