nyu-dl / dl4mt-tutorial

BSD 3-Clause "New" or "Revised" License
618 stars 249 forks source link

TypeError #81

Open sourabhdeoghare opened 5 years ago

sourabhdeoghare commented 5 years ago

Loading data Building model Building sampler Building f_init... Done Building f_next.. Done Building f_log_probs... Done Building f_cost... Done Computing gradient... Done Building optimizers... Traceback (most recent call last): File "/home/sourabh/anaconda3/lib/python3.6/site-packages/Theano-1.0.4-py3.6.egg/theano/compile/pfunc.py", line 193, in rebuild_collect_shared allow_convert=False) File "/home/sourabh/anaconda3/lib/python3.6/site-packages/Theano-1.0.4-py3.6.egg/theano/tensor/type.py", line 234, in filter_variable self=self)) TypeError: Cannot convert Type TensorType(float64, matrix) (of Variable Elemwise{add,no_inplace}.0) into Type TensorType(float32, matrix). You can try to manually convert Elemwise{add,no_inplace}.0 into a TensorType(float32, matrix).

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train_nmt.py", line 44, in 'reload': [False]}) File "train_nmt.py", line 31, in main overwrite=False) File "/home/sourabh/codes/dl4mt-tutorial-master/session1/nmt.py", line 975, in train f_grad_shared, f_update = eval(optimizer)(lr, tparams, grads, inps, cost) File "/home/sourabh/codes/dl4mt-tutorial-master/session1/nmt.py", line 773, in adam on_unused_input='ignore', profile=profile) File "/home/sourabh/anaconda3/lib/python3.6/site-packages/Theano-1.0.4-py3.6.egg/theano/compile/function.py", line 317, in function output_keys=output_keys) File "/home/sourabh/anaconda3/lib/python3.6/site-packages/Theano-1.0.4-py3.6.egg/theano/compile/pfunc.py", line 449, in pfunc no_default_updates=no_default_updates) File "/home/sourabh/anaconda3/lib/python3.6/site-packages/Theano-1.0.4-py3.6.egg/theano/compile/pfunc.py", line 208, 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=Wemb_mean, 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.')