lstm-char-cnn-tensorflow icon indicating copy to clipboard operation
lstm-char-cnn-tensorflow copied to clipboard

Dimension size must be evenly divisible by 21 but is 1 for 'LSTMTDNN/CNN/Reshape' (op: 'Reshape') with input shapes: [], [2].

Open fengjiqiang opened this issue 8 years ago • 6 comments
trafficstars

when run the 'main.py', encounter this problem.

fengjiqiang avatar Apr 12 '17 05:04 fengjiqiang

The problem may be the different version of Tensorflow API.

After

  1. Upgrading the codes (esp. LSTMDNN.py) to Tensorflow 1.0 using the script in https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility
  2. Redefining the _linear in ops.py and LSTMDNN.py Ref: http://stackoverflow.com/questions/42437115/tensorflow-replacement-for-tf-nn-rnn-cell-linearinput-size-0-scope
  3. Changing calls of tf.nn.rnn_cell to tf.contrib.rnn in LSTMDNN.py tf.nn.rnn_cell.BasicLSTMCell -> tf.contrib.rnn.BasicLSTMCell tf.nn.rnn_cell.MultiRNNCell -> tf.contrib.rnn.MultiRNNCell tf.nn.rnn -> tf.contrib.rnn.static_rnn

I can successfully run the code.

dittaya avatar Apr 12 '17 07:04 dittaya

thanks

At 2017-04-12 15:49:52, "dittaya" [email protected] wrote:

The problem may be the different version of Tensorflow API.

After

Upgrading the codes (esp. LSTMDNN.py) to Tensorflow 1.0 using the script in https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility Redefining the _linear in ops.py and LSTMDNN.py Ref: http://stackoverflow.com/questions/42437115/tensorflow-replacement-for-tf-nn-rnn-cell-linearinput-size-0-scope Changing calls of tf.nn.rnn_cell to tf.contrib.rnn in LSTMDNN.py tf.nn.rnn_cell.BasicLSTMCell -> tf.contrib.rnn.BasicLSTMCell tf.nn.rnn_cell.MultiRNNCell -> tf.contrib.rnn.MultiRNNCell tf.nn.rnn -> tf.contrib.rnn.static_rnn

I can successfully run the code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

fengjiqiang avatar Apr 21 '17 03:04 fengjiqiang

I met the same problem as you did when executing the paper code. Can you tell me how to modify the code in detail?

liubin3701 avatar May 23 '17 03:05 liubin3701

  1. Run the script to upgrade the code
  2. Define _linear function (code copied from the this link) since the new Tensorflow library does not have it.
  3. Replace every tf.nn.rnn_cell with tf.contrib.rnn .. and so on.

However, the owner of the project stated that, with this code, this code couldn't reproduce the result in the paper. I've switched to this link instead.

dittaya avatar May 24 '17 08:05 dittaya

I used the new tf-lstm-char-enn code that you suggested, but the file '../lstm-char-cnn/param_init_.t7' could not be found.

liubin3701 avatar May 26 '17 08:05 liubin3701

This codes and the new one does not required that file. I can just clone the repository and run their codes.

dittaya avatar May 29 '17 10:05 dittaya