MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _maybe_colocate

Method _maybe_colocate

tensorpack/tfutils/optimizer.py:112–118  ·  view source on GitHub ↗
(self, var)

Source from the content-addressed store, hash-verified

110
111 @contextmanager
112 def _maybe_colocate(self, var):
113 G = tf.get_default_graph()
114 if self._colocate and get_tf_version_tuple() <= (1, 12):
115 with G.colocate_with(var):
116 yield
117 else:
118 yield
119
120
121class VariableAssignmentOptimizer(PostProcessOptimizer):

Callers 1

apply_gradientsMethod · 0.95

Calls 1

get_tf_version_tupleFunction · 0.85

Tested by

no test coverage detected