Siamese-LSTM icon indicating copy to clipboard operation
Siamese-LSTM copied to clipboard

while training got Error

Open aimaaonline opened this issue 6 years ago • 3 comments

Kindly help ASAP to resolve the issus. i couldnot get the problem while training and running the Example3

File "/home/seemab/seemab/LSTM/example3.py", line 6, in sls=lstm("new.p",load=False,training=True)

File "/home/seemab/seemab/LSTM/lstm.py", line 289, in init gradi = tensor.grad(cost, wrt=tnewp.values())#/bts

File "/usr/local/lib/python3.5/dist-packages/theano/gradient.py", line 502, in grad " of type " + str(type(elem)))

TypeError: Expected Variable, got odict_values([1lstm1_U, 1lstm1_W, 1lstm1_b, 2lstm1_U, 2lstm1_W, 2lstm1_b]) of type <class 'odict_values'>

aimaaonline avatar May 18 '18 10:05 aimaaonline

In lstm.py

import os os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,floatX=float32" import theano.tensor as T

aimaaonline avatar May 23 '18 09:05 aimaaonline

你好,我也遇到了这个问题,把这句话加上并没有解决我的问题啊,请问您的环境是什么样的呢?

zpp13 avatar Aug 23 '18 09:08 zpp13

I face the same error with theano (version 1.0.4) while running different code. @aimaaonline suggestion didn't work. I was able to fix the problem when I passed a list to the grad function as follows tensor.grad(cost, wrt=list(tnewp.values()))

OmniaZayed avatar Mar 09 '19 14:03 OmniaZayed