carpedm20/simulated-unsupervised-tensorflow

TypeError: zeros_initializer() takes at least 1 argument

Soledad89 opened this issue · 2 comments

I got this error below when running the main.py script. I am using tensorflow 0.12.1. Can somebody help my out. Thanks a lot.

[!] Found images in data/gaze/UnityEyes.
[] # of synthetic data: 7373, # of cropped_data: 7373
[
] Finished preprocessing synthetic gaze data.
[*] Save samples images in data/gaze
/usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py:2699: VisibleDeprecationWarning: rank is deprecated; use the ndim attribute or function instead. To find the rank of a matrix see numpy.linalg.matrix_rank.
VisibleDeprecationWarning)
Traceback (most recent call last):
File "main.py", line 29, in
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "main.py", line 17, in main
trainer = Trainer(config, rng)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/trainer.py", line 37, in init
self.model = Model(config, self.data_loader)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/model.py", line 27, in init
self._build_model()
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/model.py", line 111, in _build_model
self.R_x = self._build_refiner(self.normalized_x)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/model.py", line 294, in _build_refiner
layer = repeat(layer, 4, resnet_block, scope="resnet")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/layers.py", line 47, in repeat
outputs = slim.repeat(inputs, repetitions, layer, **kargv)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1670, in repeat
outputs = layer(outputs, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/layers.py", line 37, in resnet_block
padding=padding, activation_fn=tf.nn.relu, scope="conv1")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "/home/w00378682/Documents/Detection/simulated-unsupervised-tensorflow/layers.py", line 61, in conv2d
biases_initializer=tf.zeros_initializer(dtype=tf.float32), scope=scope, **kargv)
TypeError: zeros_initializer() takes at least 1 argument (1 given)

I found the tf.zero_initializer() function should take another argument named shape, but I have no idea what the shape argument should be set. Besides, when I removed the dtype=tf.float32 argument, errors appeared in other parts.

I just installed the most recent TF 0.12.1 and tested it after f2d4e6e but if you continuously failed to run this code use:

tf.constant_initializer(0.0)

instead of tf.zeros_initializer which is discussed tensorflow/tensorflow#6202.

Awesome. Thanks a lot. @carpedm20