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

regarding outputs, final_state = tf.contrib.rnn.static_rnn(cell, lstm_in, dtype=tf.float32,initial_state = initial_state) #4

Open
wenouyang opened this issue Mar 19, 2018 · 3 comments

Comments

@wenouyang
Copy link

wenouyang commented Mar 19, 2018

Hi,

Thanks for sharing the code, but running the HAR-CNN_LSTM.ipynb, I got the following error message directly related to

with graph.as_default():
    outputs, final_state = tf.contrib.rnn.static_rnn(cell, lstm_in, dtype=tf.float32,
                                                     initial_state = initial_state)

The error message is as follows, would you like to take a look at it, and see how to fix it? Thanks.
ValueError: Attempt to reuse RNNCell <tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl.BasicLSTMCell object at 0x2b53b31b2710> with a different variable scope than its first use. First use of cell was with scope 'rnn/multi_rnn_cell/cell_0/basic_lstm_cell', this attempt is with scope 'rnn/multi_rnn_cell/cell_1/basic_lstm_cell'. Please create a new instance of the cell if you would like it to use a different set of weights. If before you were using: MultiRNNCell([BasicLSTMCell(...)] * num_layers), change to: MultiRNNCell([BasicLSTMCell(...) for _ in range(num_layers)]). If before you were using the same cell instance as both the forward and reverse cell of a bidirectional RNN, simply create two instances (one for forward, one for reverse). In May 2017, we will start transitioning this cell's behavior to use existing stored weights, if any, when it is called with scope=None (which can lead to silent model degradation, so this error will remain until then.)

@bhimmetoglu
Copy link
Contributor

Thanks for reporting. This is a problem that appears with the latest tensorflow ( version >= 1.5), and I will update the code to fix it.

@wenouyang
Copy link
Author

wenouyang commented Mar 20, 2018

Hi, thank you for the reply. By the way, I was trying to adapt your model to some use cases I am interested. One observation for my use case is that the data set consists of very small values, such as -3.82587010e-11, The attached image shows an input vector example. Are there any recommendations to pre-process these vectors.

capture 1

@bhimmetoglu
Copy link
Contributor

Maybe you can normalize these values by dividing with the max of the absolute value, or some other transformation that will re-scale the data into an interval [0,1]

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