Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: zeros_initializer() takes at least 1 argument #5

Closed
Soledad89 opened this issue Jan 14, 2017 · 2 comments
Closed

TypeError: zeros_initializer() takes at least 1 argument #5

Soledad89 opened this issue Jan 14, 2017 · 2 comments

Comments

@Soledad89
Copy link
Contributor

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.

@carpedm20
Copy link
Owner

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.

@Soledad89
Copy link
Contributor Author

Awesome. Thanks a lot. @carpedm20

danrasmuson pushed a commit to danrasmuson/docker-StackGAN that referenced this issue May 1, 2017
Looks like HEAD of prettytensor must be used with HEAD of tensorflow.

Here is the error I'm hitting with version 0.7.4
carpedm20/simulated-unsupervised-tensorflow#5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants