ericjang / gumbel-softmax

categorical variational autoencoder using the Gumbel-Softmax estimator
MIT License
425 stars 101 forks source link

error in gs vae v2 #4

Closed tigerneil closed 7 years ago

tigerneil commented 7 years ago

Hi, I use TensorFlow 1.1.0 without gpu in mac osx 10.12.3 to test gumbel_softmax_vae_v2.ipynb I use ipython to run the code line by line, the error occurs in defining logits_y. Hard to find in google or other areas. Any comments?

In [12]: logits_y = tf.reshape(slim.fully_connected(net,K*N,activation_fn=None),[-1,N,K])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-d72f3b04d264> in <module>()
----> 1 logits_y = tf.reshape(slim.fully_connected(net,K*N,activation_fn=None),[-1,N,K])

/Users/Tiger/anaconda/envs/pytorch3/lib/python3.5/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py in func_with_args(*args, **kwargs)
    179       current_args = current_scope[key_func].copy()
    180       current_args.update(kwargs)
--> 181     return func(*args, **current_args)
    182   _add_op(func)
    183   setattr(func_with_args, '_key_op', _key_op(func))

/Users/Tiger/anaconda/envs/pytorch3/lib/python3.5/site-packages/tensorflow/contrib/layers/python/layers/layers.py in fully_connected(inputs, num_outputs, activation_fn, normalizer_fn, normalizer_params, weights_initializer, weights_regularizer, biases_initializer, biases_regularizer, reuse, variables_collections, outputs_collections, trainable, scope)
   1408   """
   1409   if not isinstance(num_outputs, six.integer_types):
-> 1410     raise ValueError('num_outputs should be int or long, got %s.', num_outputs)
   1411
   1412   layer_variable_getter = _build_variable_getter({'bias': 'biases',

ValueError: ('num_outputs should be int or long, got %s.', 200.0)
ericjang commented 7 years ago

Thanks for bringing this to my attention. Fixed via https://github.com/ericjang/gumbel-softmax/commit/4deb8bd4788432c86a0587b97a2d3e16f9e9b6a1