98c6d3bc803e5d04be425e6b2eabca3ea707ed0e,finetune/nn/target_blocks.py,,_apply_class_weight,#,134

Before Change


        weights = (
            tf.reduce_sum(input_tensor=class_weights * tf.cast(targets, dtype=tf.float32), axis=1)
        )
        weights *= tf.cast(tf.reduce_prod(input_tensor=tf.shape(input=weights)), dtype=tf.float32) / tf.reduce_sum(
            input_tensor=weights
        )
        losses *= tf.expand_dims(weights, 1)
    return losses

After Change


        weights = tf.reduce_sum(
            input_tensor=class_weights * tf.cast(targets, dtype=tf.float32), axis=1
        )
        weights *= tf.math.divide_no_nan(
            tf.cast(
                tf.reduce_prod(input_tensor=tf.shape(input=weights)), dtype=tf.float32
            ),
            tf.reduce_sum(input_tensor=weights),
        )
        losses *= tf.expand_dims(weights, 1)
    return losses
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: IndicoDataSolutions/finetune
Commit Name: 98c6d3bc803e5d04be425e6b2eabca3ea707ed0e
Time: 2020-08-24
Author: madison@indico.io
File Name: finetune/nn/target_blocks.py
Class Name:
Method Name: _apply_class_weight


Project Name: GPflow/GPflow
Commit Name: 3af7b8e9372ea8a5abbc9da68123508a8737fe0f
Time: 2019-11-19
Author: mark@prowler.io
File Name: gpflow/models/sgpr.py
Class Name: SGPRUpperMixin
Method Name: upper_bound


Project Name: IndicoDataSolutions/finetune
Commit Name: 98c6d3bc803e5d04be425e6b2eabca3ea707ed0e
Time: 2020-08-24
Author: madison@indico.io
File Name: finetune/nn/target_blocks.py
Class Name:
Method Name: language_model