80d314ae5eaadc88061a62c827e1b8670098c1ab,rllib/utils/exploration/random.py,Random,get_tf_exploration_action_op,#Random#Any#Any#,56

Before Change



    @tf_function(tf)
    def get_tf_exploration_action_op(self, action_dist, explore):
        if explore:
            action = tf.py_function(self.action_space.sample, [],
                                    self.dtype_sample)
            // Will be unnecessary, once we support batch/time-aware Spaces.
            action = tf.expand_dims(tf.cast(action, dtype=self.dtype), 0)
        else:
            action = tf.cast(
                action_dist.deterministic_sample(), dtype=self.dtype)

        // TODO(sven): Move into (deterministic_)sample(logp=True|False)
        if isinstance(action, TupleActions):
            batch_size = tf.shape(action[0][0])[0]
        else:
            batch_size = tf.shape(action)[0]

After Change


            return tf.cast(
                action_dist.deterministic_sample(), dtype=self.dtype)

        action = tf.cond(
            pred=tf.constant(explore, dtype=tf.bool)
            if isinstance(explore, bool) else explore,
            true_fn=true_fn,
            false_fn=false_fn)

        // TODO(sven): Move into (deterministic_)sample(logp=True|False)
        if isinstance(action, TupleActions):
            batch_size = tf.shape(action[0][0])[0]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: ray-project/ray
Commit Name: 80d314ae5eaadc88061a62c827e1b8670098c1ab
Time: 2020-03-12
Author: sven@anyscale.io
File Name: rllib/utils/exploration/random.py
Class Name: Random
Method Name: get_tf_exploration_action_op


Project Name: tryolabs/luminoth
Commit Name: dda92a618d946a3f201e289d0010d780a76807d6
Time: 2018-03-20
Author: iangtayler@gmail.com
File Name: luminoth/models/ssd/ssd.py
Class Name: SSD
Method Name: loss


Project Name: hanxiao/bert-as-service
Commit Name: ec1fbf3d4b9c224f69ea13fecaed1cd7b318b55a
Time: 2019-02-13
Author: hanhxiao@tencent.com
File Name: server/bert_serving/server/bert/modeling.py
Class Name:
Method Name: embedding_postprocessor