Theano error when running Quick example
Solved!Posted in General by Luis A. Molina Sun Jun 12 2016 02:03:03 GMT+0000 (Coordinated Universal Time)·3·Viewed 5,432 times
When running the Quick example of the MLP on the MNIST data I am getting the following error when running on Python 3.5:
Using gpu device 0: GeForce GT 650M (CNMeM is disabled, cuDNN not available)
Getting data...
Creating model...
Training...
Traceback (most recent call last):
File "<ipython-input-2-360694695dce>", line 1, in <module>
runfile('/Users/molinal/SkyDrive/AI/opendeep/mlp_opendeep.py', wdir='/Users/molinal/SkyDrive/AI/opendeep')
File "/Users/molinal/anaconda/envs/tensorflow/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/Users/molinal/anaconda/envs/tensorflow/lib/python3.5/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/Users/molinal/SkyDrive/AI/opendeep/mlp_opendeep.py", line 34, in <module>
optimizer.train()
File "/Users/molinal/OpenDeep/opendeep/optimization/optimizer.py", line 380, in train
self.STOP = self._perform_one_epoch(f_learn, plot)
File "/Users/molinal/OpenDeep/opendeep/optimization/optimizer.py", line 422, in _perform_one_epoch
_outs = raise_to_list(f_learn(*batch))
File "/Users/molinal/anaconda/pkgs/theano/compile/function_module.py", line 786, in __call__
allow_downcast=s.allow_downcast)
File "/Users/molinal/anaconda/pkgs/theano/tensor/type.py", line 177, in filter
data.shape))
TypeError: ('Bad input argument to theano function with name "f_learn" at index 0(0-based)', 'Wrong number of dimensions: expected 2, got 4 with shape (100, 1, 28, 28).')
Forgot to update the example! MNIST is now 2D by default, this example assumes 1D. You have to initialize MNIST now with flatten=True argument.
marked this as solved
That fixed the issue! Thank you.