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

ImportError: This module is deprecated. Use tf.nn.rnn_cell instead. #16

Open
ilovezhenzhen opened this issue Dec 15, 2016 · 7 comments
Open

Comments

@ilovezhenzhen
Copy link

ImportError: This module is deprecated. Use tf.nn.rnn_cell instead.

use from tensorflow.python.ops import rnn_cell but
ValueError: setting an array element with a sequence.

@YuDeng
Copy link

YuDeng commented Dec 22, 2016

You can just revise the code in initial function: change self.lstm = xxxxx into self.lstm = tf.nn.rnncell.BasicLSTMCell(xxx), and delete from tf.model.nn import rnn_cell

@Spiritdude
Copy link

Spiritdude commented Jan 25, 2017

I still get ValueError: setting an array element with a sequence. after:

           self.lstm = tf.nn.rnn_cell.BasicLSTMCell(dim_hidden)

using TF 0.11.0, I get this:

Using TensorFlow backend.
Traceback (most recent call last):
  File "recog.py", line 33, in <module>
    fc7_tf, generated_words_tf = caption_generator.build_generator(maxlen=maxlen)
  File "..../show_and_tell.tensorflow.orig/model.py", line 95, in build_generator
    state = tf.zeros([1, self.lstm.state_size])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1184, in zeros
    shape = ops.convert_to_tensor(shape, dtype=dtypes.int32, name="shape")
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 657, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 180, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 163, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 354, in make_tensor_proto
    nparray = np.array(values, dtype=np_dt)
ValueError: setting an array element with a sequence.

@xieqiangqiang
Copy link

xieqiangqiang commented Feb 26, 2017

@ilovezhenzhen @Spiritdude
i have same proplem. do you have resolved it?
ValueError: setting an array element with a sequence.

@ecilay
Copy link

ecilay commented Mar 31, 2017

same problem as above.
Do you have resolved it? @xieqiangqiang @Spiritdude @YuDeng

@Hitagi-Hu
Copy link

+1,have someone fixed the ValueError?

@karaanil
Copy link

karaanil commented May 17, 2017

Use below lines in model.py

from tensorflow.contrib.rnn import BasicLSTMCell
from tensorflow.contrib.keras import preprocessing

@Jason-xin
Copy link

Jason-xin commented May 14, 2018

import tensorflow as tf
tf

then you will get the location of tensorflow in you compute. you can find the responding file path in your tensorflow.

For me (tensorflow 1.5.0 version),the location are
from tensorflow.contrib.rnn.python.ops import rnn_cell from tensorflow.contrib.keras.api.keras.preprocessing import sequence

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

8 participants