facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

Feeding feature vectors into LSTM #1208

Open gabriellapizzuto opened 7 years ago

gabriellapizzuto commented 7 years ago

I have obtained the feature vectors from last layer of the CNN (10, 50, 4, 4). I would like to feed them into LSTM (using char_rnn.py code modified).

However, I am getting the following error of matrix mismatch: RuntimeError: [enforce fail at fully_connected_op.h:61] K == W.size() / W.dim32(0). Dimension mismatch: X: 10 50 4 4, W: 400 2, b: 400, axis: 2, M: 500, N: 400, K: 16 Error from operator: input: "input_blob" input: "LSTM/i2h_w" input: "LSTM/i2h_b" output: "LSTM/i2h" name: "" type: "FC" arg { name: "use_cudnn" i: 1 } arg { name: "cudnn_exhaustive_search" i: 0 } arg { name: "order" s: "NCHW" } arg { name: "axis" i: 2 }.

Any suggestions on how to solve this issue ?

kasiabozek commented 7 years ago

I had the same problem. Did you try setting dim_in=16 in LSTM? It is size of your 4x4 CNN layer.