89326c618dcf420a79139034b02250a09335ba01,rasa/utils/tensorflow/layers.py,DotProductLoss,_random_indices,#DotProductLoss#Any#Any#,601

Before Change


        // create first random array of indices
        out1 = rand_idxs()  // (1, num_neg)

        return tf.nest.map_structure(
            tf.stop_gradient,
            tf.while_loop(
                cond,
                body,
                loop_vars=[idx1, out1],
                shape_invariants=[idx1.shape, tf.TensorShape([None, self.num_neg])],
                parallel_iterations=self.parallel_iterations,
            ),
        )[1]

    @staticmethod
    def _sample_idxs(batch_size: tf.Tensor, x: tf.Tensor, idxs: tf.Tensor) -> tf.Tensor:
        Sample negative examples for given indices

After Change


    def _random_indices(
        self, batch_size: tf.Tensor, total_candidates: tf.Tensor
    ) -> tf.Tensor:
        return tf.random.uniform(
            shape=(batch_size, self.num_neg), maxval=total_candidates, dtype=tf.int32
        )

    @staticmethod
    def _sample_idxs(batch_size: tf.Tensor, x: tf.Tensor, idxs: tf.Tensor) -> tf.Tensor:
        Sample negative examples for given indices
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: RasaHQ/rasa
Commit Name: 89326c618dcf420a79139034b02250a09335ba01
Time: 2021-01-26
Author: mr.voov@gmail.com
File Name: rasa/utils/tensorflow/layers.py
Class Name: DotProductLoss
Method Name: _random_indices


Project Name: asyml/texar
Commit Name: b41104d53d3fe1979029a4edea5dc9943dd4037a
Time: 2017-12-07
Author: zhiting.hu@petuum.com
File Name: texar/modules/decoders/rnn_decoders.py
Class Name: BasicRNNDecoder
Method Name: output_size


Project Name: Bihaqo/t3f
Commit Name: b78c8ff34ec25786831184b32c236aef9f08cd9e
Time: 2017-01-25
Author: novikov@bayesgroup.ru
File Name: tensor_train.py
Class Name: TensorTrain
Method Name: get_shape


Project Name: RasaHQ/rasa
Commit Name: dd4293e7ee9ebd0f03c0c3d134d61993fd9f2d2b
Time: 2018-07-27
Author: mr.voov@gmail.com
File Name: rasa_core/policies/embedding_policy.py
Class Name: TimeAttentionWrapper
Method Name: state_size