rdevon / cortex_old

Cortex - Deep learning tools for neuroimaging
GNU General Public License v3.0
31 stars 11 forks source link

issue about TensorType #14

Open wangdaxiao opened 7 years ago

wangdaxiao commented 7 years ago

when I run demos it appears problem like this:

eeedl@eeedl-OptiPlex-7040:~$ cortex-rbm-demo Loading experiment from /home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/rbm_mnist.yaml Experiment hyperparams: {'dataset_args': {'dataset': 'mnist', 'source': '$data/basic/mnist_binarized_salakhutdinov.pkl.gz'}, 'dim_h': 200, 'inference_args': {'n_chains': 10, 'n_steps': 1, 'persistent': True}, 'learning_args': {'epochs': 1000, 'learning_rate': 0.01, 'optimizer': 'sgd'}, 'name': 'rbm_mnist', 'test_every': 10} Saving to /home/eeedl/cortex/program/rbm_mnist Dataset args: {'dataset': 'mnist', 'source': '$data/basic/mnist_binarized_salakhutdinov.pkl.gz'} Learning args: {'batch_size': 100, 'epochs': 1000, 'excludes': [], 'learning_rate': 0.01, 'learning_rate_schedule': None, 'optimizer': 'sgd', 'optimizer_args': {}, 'valid_batch_size': 100, 'valid_key': 'nll', 'valid_sign': '+'} Inference args: {'n_chains': 10, 'n_steps': 1, 'persistent': True} ---Setting up data-------------------------------------------------------------------------------------------------------------------------------------- Loading mnist (train) from /home/eeedl/cortex/program/basic/mnist_binarized_salakhutdinov.pkl.gz Loading mnist (valid) from /home/eeedl/cortex/program/basic/mnist_binarized_salakhutdinov.pkl.gz ---Setting model and variables-------------------------------------------------------------------------------------------------------------------------- ---Loading model and forming graph---------------------------------------------------------------------------------------------------------------------- Print profile for tparams (name, shape) rbm_W (784, 200) rbm_visible_z (784,) rbm_hidden_z (200,) ---Getting cost----------------------------------------------------------------------------------------------------------------------------------------- ---Test functions--------------------------------------------------------------------------------------------------------------------------------------- ---Setting final tparams and save function-------------------------------------------------------------------------------------------------------------- Learned model params: ['rbm_W', 'rbm_visible_z', 'rbm_hidden_z'] Saved params: ['rbm_W', 'rbm_visible_z', 'rbm_hidden_z'] ---Getting gradients and building optimizer.------------------------------------------------------------------------------------------------------------ Traceback (most recent call last): File "/home/eeedl/anaconda2/bin/cortex-rbm-demo", line 11, in load_entry_point('cortex==0.12a0', 'console_scripts', 'cortex-rbm-demo')() File "/home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/cortex/demos/demos_basic/init.py", line 30, in run_rbm_demo run_demo(yaml_file, train) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/cortex/demos/demos_basic/init.py", line 18, in run_demo train(exp_dict) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/cortex/demos/demos_basic/rbm_mnist.py", line 167, in train [X], cost, tparams, constants, updates, extra_outs, learning_args) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/cortex/utils/training.py", line 291, in set_optimizer extra_outs=extra_outs, **optimizer_args) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/cortex-0.12a0-py2.7.egg/cortex/utils/op.py", line 301, in sgd f_update = theano.function(lr, [], updates=pup, profile=profile) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/theano/compile/function.py", line 326, in function output_keys=output_keys) File "/home/eeedl/anaconda2/lib/python2.7/site-packages/theano/compile/pfunc.py", line 449, in pfunc no_default_updates=no_default_updates) File "/home/eeedl/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=W, shared_var.type=TensorType(float32, matrix), 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_tounbroadcast[, ...]) function to remove broadcastable dimensions.')_

and I use theano 0.9.0.

carricky commented 6 years ago

Same issue here. Also using theano 0.9.0