4d49910b3f0696102f813fb5ba451b934a4a579c,opennmt/utils/losses.py,,cross_entropy_sequence_loss,#Any#Any#Any#Any#Any#Any#Any#,28

Before Change


    dtype = cross_entropy.dtype

    if sequence_weight is not None:
        cross_entropy *= tf.expand_dims(tf.cast(sequence_weight, dtype), 1)

    if sequence_length is not None:
        max_time = tf.shape(logits)[1]
        mask = tf.sequence_mask(sequence_length, maxlen=max_time, dtype=dtype)

After Change


    if average_in_time or not training:
        loss_normalizer = loss_token_normalizer
    elif sequence_weight is not None:
        loss_normalizer = tf.reduce_sum(sequence_weight)
    else:
        loss_normalizer = tf.cast(batch_size, dtype)

    return loss, loss_normalizer, loss_token_normalizer
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: OpenNMT/OpenNMT-tf
Commit Name: 4d49910b3f0696102f813fb5ba451b934a4a579c
Time: 2021-03-25
Author: guillaumekln@users.noreply.github.com
File Name: opennmt/utils/losses.py
Class Name:
Method Name: cross_entropy_sequence_loss


Project Name: GPflow/GPflow
Commit Name: d1ac7b831ad36cd0e4bdd7980819f83208345148
Time: 2018-02-07
Author: alex.ialongo@gmail.com
File Name: gpflow/expectations.py
Class Name:
Method Name: _expectation


Project Name: GPflow/GPflow
Commit Name: 1d3e25c3ad4835ee298675f557e4c78bc8501c74
Time: 2017-03-06
Author: james.hensman@gmail.com
File Name: GPflow/ekernels.py
Class Name: RBF
Method Name: eKxz


Project Name: tensorflow/agents
Commit Name: 6f3a917e94edf2b96e4c151d698495799be5c9de
Time: 2020-06-26
Author: summeryue@google.com
File Name: tf_agents/agents/sac/sac_agent.py
Class Name: SacAgent
Method Name: alpha_loss