SentenceRepresentation
SentenceRepresentation copied to clipboard
An update must have the same type as the original shared variable
Thank you for publishing this code.
After following the instructions for SDAE, I run train_book.py and receive an error which suggests a shard variable is being overwritten with data of a different type.
Please could you help
File "train_book.py", line 55, in <module>
'test_text': ['newstest.tok.en']})
File "train_book.py", line 32, in main
embeddings=params['embeddings'][0])
File "../SentenceRepresentation/SDAE/desent.py", line 905, in train
f_grad_shared, f_update = eval(optimizer)(lr, tparams, grads, inps, cost)
File "../SentenceRepresentation/SDAE/desent.py", line 711, in adam
f_update = theano.function([lr], [], updates=updates, on_unused_input='ignore')
File "../local/lib/python2.7/site-packages/theano/compile/function.py", line 320, in function
output_keys=output_keys)
File "../local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 442, in pfunc
no_default_updates=no_default_updates)
File "../local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 207, in rebuild_collect_shared
raise TypeError(err_msg, err_sug)
TypeError: ('An update must have the same type as the original shared variable (shared_var=<TensorType(float32, matrix)>, shared_var.type=TensorType(float32, matrix), update_val=Elemwise{add,no_inplace}.0, update_val.type=TensorType(float64, matrix)).', 'If the difference is related to the broadcast pattern, you can call the tensor.unbroadcast(var, axis_to_unbroadcast[, ...]) function to remove broadcastable dimensions.')