I'm on Tensorflow 1.3.0, this issue persisted when running primal_testing even if I used tf.global_variables_initializer()
Here is the full traceback:
Hello World... From global
Starting tests for 4 agents
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1306, in _run_fn
status, run_metadata)
File "/usr/lib/python3.6/contextlib.py", line 88, in __exit__
next(self.gen)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value global/qvalues/Conv/weights
[[Node: global/qvalues/Conv/weights/read = Identity[T=DT_FLOAT, _class=["loc:@global/qvalues/Conv/weights"], _device="/job:localhost/replica:0/task:0/cpu:0"](global/qvalues/Conv/weights)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "primal_testing.py", line 147, in <module>
run_simulations((num_agents,size,density,iter),primal)
File "primal_testing.py", line 117, in run_simulations
path=primal.find_path(256 + 128*int(s>=80) + 128*int(s>=160))
File "primal_testing.py", line 85, in find_path
self.step_all_parallel()
File "primal_testing.py", line 55, in step_all_parallel
self.network.goal_pos:goal_pos})
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1124, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1321, in _do_run
options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value global/qvalues/Conv/weights
[[Node: global/qvalues/Conv/weights/read = Identity[T=DT_FLOAT, _class=["loc:@global/qvalues/Conv/weights"], _device="/job:localhost/replica:0/task:0/cpu:0"](global/qvalues/Conv/weights)]]
Caused by op 'global/qvalues/Conv/weights/read', defined at:
File "primal_testing.py", line 134, in <module>
primal=PRIMAL('model_primal',10)
File "primal_testing.py", line 26, in __init__
self.network=ACNet("global",5,None,False,grid_size,"global")
File "/home/mapm_test/mapm_primal/ACNet.py", line 26, in __init__
self.policy, self.value, self.state_out, self.state_in, self.state_init, self.blocking, self.on_goal,self.valids = self._build_net(self.myinput,self.goal_pos,RNN_SIZE,TRAINING,a_size)
File "/home/mapm_test/mapm_primal/ACNet.py", line 78, in _build_net
conv1 = layers.conv2d(inputs=inputs, padding="SAME", num_outputs=RNN_SIZE//4, kernel_size=[3, 3], stride=1, data_format="NHWC", weights_initializer=w_init,activation_fn=tf.nn.relu)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
return func(*args, **current_args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1027, in convolution
outputs = layer.apply(inputs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/base.py", line 503, in apply
return self.__call__(inputs, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/base.py", line 443, in __call__
self.build(input_shapes[0])
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/convolutional.py", line 137, in build
dtype=self.dtype)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/base.py", line 383, in add_variable
trainable=trainable and self.trainable)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py", line 1065, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py", line 962, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py", line 360, in get_variable
validate_shape=validate_shape, use_resource=use_resource)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1561, in layer_variable_getter
return _model_variable_getter(getter, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1553, in _model_variable_getter
custom_getter=getter, use_resource=use_resource)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
return func(*args, **current_args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 261, in model_variable
use_resource=use_resource)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
return func(*args, **current_args)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/variables.py", line 216, in variable
use_resource=use_resource)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py", line 352, in _true_getter
use_resource=use_resource)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variable_scope.py", line 725, in _get_single_variable
validate_shape=validate_shape)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variables.py", line 199, in __init__
expected_shape=expected_shape)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/variables.py", line 330, in _init_from_args
self._snapshot = array_ops.identity(self._variable, name="read")
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1400, in identity
result = _op_def_lib.apply_op("Identity", input=input, name=name)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 2630, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 1204, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
FailedPreconditionError (see above for traceback): Attempting to use uninitialized value global/qvalues/Conv/weights
[[Node: global/qvalues/Conv/weights/read = Identity[T=DT_FLOAT, _class=["loc:@global/qvalues/Conv/weights"], _device="/job:localhost/replica:0/task:0/cpu:0"](global/qvalues/Conv/weights)]]
I'm on Tensorflow 1.3.0, this issue persisted when running primal_testing even if I used
tf.global_variables_initializer()
Here is the full traceback: