Discussion:
[theano-users] Type mismatch TensorType(float64, row) TensorType(float64, matrix)
Vimal K
2017-06-23 07:43:38 UTC
Permalink
i am trying to run this program https://github.com/npow/ubottu for making
a model for Ubuntu Dialog Corpus

It uses Theano and Lasagne as dependencies.

when i install Theano and Lasagne from pip, and do a simple

import lasagne


i get the error

from theano.tensor.signal import downsampleImportError: cannot import name 'downsample'


then found a workaround
here, https://stackoverflow.com/questions/42998355/lasagne-vs-theano-possible-version-mismatch-windows
suggestion was to install Theano and Lasagne from their github master
branches respectively

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip


This removed the above erorr, but i am getting the following error.


TypeError: ('An update must have the same type as the original shared
variable (shared_var=hid_init, shared_var.type=TensorType(float64, row),
update_val=Elemwise{sub,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.')



it seems that there is a type mismatch somewhere. a variable of row type is
updated with a value of matrix type. Full traceback as follows :

Traceback (most recent call last):
File "main.py", line 669, in <module>
main()
File "main.py", line 661, in main
model = Model(**args.__dict__)
File "main.py", line 375, in __init__
self.update_params()
File "main.py", line 408, in update_params
self.train_model = theano.function([], self.cost, updates=updates,
givens=givens, on_unused_input='warn')
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/theano/compile/function.py"
, line 326, in function
output_keys=output_keys)
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/theano/compile/pfunc.py",
line 449, in pfunc
no_default_updates=no_default_updates)
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/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=cell_init, shared_var.type=TensorType(float64, row),
update_val=Elemwise{sub,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.')






the versions are
import theano as th
print th.__version__
0.10.0dev1.dev-RELEASE
import lasagne as la
print la.__version__
0.2.dev1






Can you help me to resolve this error?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal Lamblin
2017-07-01 00:24:02 UTC
Permalink
It's hard to know from that level, but somewhere there is a shared variable
that is a row (1 x n matrix), and its update value is a full matrix (k x m).
This could be a parameter of the model, or a value updated by the optimizer
(something like a velocity).
It is possible that the update value is actually always 1 x n, but Theano
could not infer that (in which case, this is an issue in Theano and we
should fix it), in that case you can use tensor.addbroadcast() on the
update expression (it will fail if k != 1 at runtime).
It is also possible that k != 1, in which case it is a problem in the model
itself.
Post by Vimal K
i am trying to run this program https://github.com/npow/ubottu for
making a model for Ubuntu Dialog Corpus
It uses Theano and Lasagne as dependencies.
when i install Theano and Lasagne from pip, and do a simple
import lasagne
i get the error
from theano.tensor.signal import downsampleImportError: cannot import name 'downsample'
then found a workaround here,
https://stackoverflow.com/questions/42998355/lasagne-vs-theano-possible-version-mismatch-windows
suggestion was to install Theano and Lasagne from their github master
branches respectively
pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
This removed the above erorr, but i am getting the following error.
TypeError: ('An update must have the same type as the original shared
variable (shared_var=hid_init, shared_var.type=TensorType(float64, row),
update_val=Elemwise{sub,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.')
it seems that there is a type mismatch somewhere. a variable of row type
File "main.py", line 669, in <module>
main()
File "main.py", line 661, in main
model = Model(**args.__dict__)
File "main.py", line 375, in __init__
self.update_params()
File "main.py", line 408, in update_params
self.train_model = theano.function([], self.cost, updates=updates,
givens=givens, on_unused_input='warn')
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/theano/compile/function.py"
, line 326, in function
output_keys=output_keys)
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/theano/compile/pfunc.py"
, line 449, in pfunc
no_default_updates=no_default_updates)
File
"/home/vimal/anaconda2/lib/python2.7/site-packages/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=cell_init, shared_var.type=TensorType(float64, row),
update_val=Elemwise{sub,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.')
the versions are
import theano as th
print th.__version__
0.10.0dev1.dev-RELEASE
import lasagne as la
print la.__version__
0.2.dev1
Can you help me to resolve this error?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...