94855fb1910ff6b9dd8306dafd097ac9f93eb57b,kfac/python/ops/utils.py,,cross_replica_mean,#Any#Any#,351
Before Change
with tf.name_scope(name, "cross_replica_mean", [tensor]):
num_shards = get_num_tpu_shards()
if num_shards is None:
raise ValueError(
"Cannot take cross_replica_mean() outside of TPU Context.")
if num_shards == 1:
return tensor
return tf.contrib.tpu.cross_replica_sum(tensor / num_shards)
After Change
if num_replicas and num_replicas > 1:
with tf.name_scope(name, "cross_replica_mean", nest.flatten(structure)):
return nest.map_structure(
lambda x: tf.contrib.tpu.cross_replica_sum(x / num_replicas),
structure)
else:
return structure
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: tensorflow/kfac
Commit Name: 94855fb1910ff6b9dd8306dafd097ac9f93eb57b
Time: 2019-08-13
Author: jamesmartens@google.com
File Name: kfac/python/ops/utils.py
Class Name:
Method Name: cross_replica_mean
Project Name: ray-project/ray
Commit Name: 1775e89f262111791fabfd40f80a24f74738fe54
Time: 2020-04-28
Author: sven@anyscale.io
File Name: rllib/policy/policy.py
Class Name:
Method Name: clip_action
Project Name: tensorflow/agents
Commit Name: c62215debda5bf5d89723f4112f1e3e2f063cd52
Time: 2020-04-17
Author: kokiopou@google.com
File Name: tf_agents/trajectories/time_step.py
Class Name:
Method Name: termination
Project Name: tensorflow/agents
Commit Name: 1bef8a0cb502401e33f8572897d981ef81a1a829
Time: 2020-04-30
Author: bartok@google.com
File Name: tf_agents/bandits/policies/neural_linucb_policy.py
Class Name: NeuralLinUCBPolicy
Method Name: _action