Commit ba2758b3 authored by Yuxin Wu's avatar Yuxin Wu

remove get_variable_on_tower. fix #243

parent 3e9de2ae
# issue#1924 may happen on old systems
import cv2 # noqa
import os
# issue#7378 may happen with custom opencv. It doesn't hurt to disable opencl
import os
os.environ['OPENCV_OPENCL_RUNTIME'] = ''
os.environ['TF_ENABLE_WINOGRAD_NONFUSED'] = '1' # issue#9339
......
......@@ -48,24 +48,6 @@ class TowerContext(object):
return 0
return int(self._name[-1])
def get_variable_on_tower(self, *args, **kwargs):
"""
Get a variable for this tower specifically, without reusing, even if
it is called under a ``reuse=True`` variable scope.
Tensorflow doesn't allow us to disable reuse under a
``reuse=True`` scope. This method provides a work around.
See https://www.tensorflow.org/versions/master/how_tos/variable_scope/index.html#basics-of-tfvariable-scope
Args:
args: same as ``tf.get_variable()``.
"""
with tf.variable_scope(self._name) as scope:
with tf.variable_scope(scope, reuse=False):
scope = tf.get_variable_scope()
assert not scope.reuse
return tf.get_variable(*args, **kwargs)
def find_tensor_in_main_tower(self, graph, name):
if self.is_main_tower:
return graph.get_tensor_by_name(name)
......
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