ee950b503eeed5aca3747a4bcf2a40f624b743a0,tensorforce/core/optimizers/synchronization.py,Synchronization,tf_step,#Synchronization#Any#Any#Any#,58

Before Change


                deltas.append(delta)
            return deltas

        sync_frequency = self.sync_frequency.value()
        skip_sync = (time - self.last_sync < sync_frequency)
        return self.cond(pred=skip_sync, true_fn=no_sync, false_fn=apply_sync)

After Change


            **kwargs: Additional arguments, not used.

        Returns:
            List of delta tensors corresponding to the updates for each optimized variable.
        
        assert all(
            util.shape(source) == util.shape(target)
            for source, target in zip(source_variables, variables)
        )

        timestep = Module.retrieve_tensor(name="timestep")

        def apply_sync():
            update_weight = self.update_weight.value()
            deltas = list()
            for source_variable, target_variable in zip(source_variables, variables):
                delta = update_weight * (source_variable - target_variable)
                deltas.append(delta)

            applied = self.apply_step(variables=variables, deltas=deltas)
            last_sync_updated = self.last_sync.assign(value=timestep)

            with tf.control_dependencies(control_inputs=(applied, last_sync_updated)):
                // Trivial operation to enforce control dependency
                return [util.identity_operation(x=delta) for delta in deltas]

        def no_sync():
            deltas = list()
            for variable in variables:
                delta = tf.zeros(shape=util.shape(variable))
                deltas.append(delta)
            return deltas

        sync_frequency = self.sync_frequency.value()
        skip_sync = (timestep - self.last_sync < sync_frequency)
        return self.cond(pred=skip_sync, true_fn=no_sync, false_fn=apply_sync)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: reinforceio/tensorforce
Commit Name: ee950b503eeed5aca3747a4bcf2a40f624b743a0
Time: 2019-01-21
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/optimizers/synchronization.py
Class Name: Synchronization
Method Name: tf_step


Project Name: reinforceio/tensorforce
Commit Name: f19c4f5cfecdccd65a65f298fd26f17b9d21ad52
Time: 2019-06-13
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/distributions/gaussian.py
Class Name: Gaussian
Method Name: tf_sample


Project Name: reinforceio/tensorforce
Commit Name: a3fe8bdf1c484e390dfe3947cc395372c0187589
Time: 2019-02-06
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/distributions/beta.py
Class Name: Beta
Method Name: tf_sample