Commit 363777e4 authored by Yuxin Wu's avatar Yuxin Wu

Don't colocate weight_decay. Affect speeds for PS mode.

parent 4c1d57d2
...@@ -56,8 +56,6 @@ def regularize_cost(regex, func, name='regularize_cost'): ...@@ -56,8 +56,6 @@ def regularize_cost(regex, func, name='regularize_cost'):
else: else:
params = tf.trainable_variables() params = tf.trainable_variables()
G = tf.get_default_graph()
to_regularize = [] to_regularize = []
with tf.name_scope(name + '_internals'): with tf.name_scope(name + '_internals'):
...@@ -65,7 +63,6 @@ def regularize_cost(regex, func, name='regularize_cost'): ...@@ -65,7 +63,6 @@ def regularize_cost(regex, func, name='regularize_cost'):
for p in params: for p in params:
para_name = p.op.name para_name = p.op.name
if re.search(regex, para_name): if re.search(regex, para_name):
with G.colocate_with(p):
costs.append(func(p)) costs.append(func(p))
to_regularize.append(p.name) to_regularize.append(p.name)
if not costs: if not costs:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment