Skip to content

Instantly share code, notes, and snippets.

@qharlie
Created June 30, 2017 02:34
Show Gist options
  • Save qharlie/2818deba2b6644e3c1794943b2e7335a to your computer and use it in GitHub Desktop.
Save qharlie/2818deba2b6644e3c1794943b2e7335a to your computer and use it in GitHub Desktop.
ValueError Traceback (most recent call last)
<ipython-input-7-5cf5b03019f2> in <module>()
24 model.compile(loss='mean_squared_error', optimizer=optimizer)
25
---> 26 model.fit(X_train, y_train, epochs=100, verbose=2)
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/keras/models.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs)
868 class_weight=class_weight,
869 sample_weight=sample_weight,
--> 870 initial_epoch=initial_epoch)
871
872 def evaluate(self, x, y, batch_size=32, verbose=1,
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, **kwargs)
1505 val_f=val_f, val_ins=val_ins, shuffle=shuffle,
1506 callback_metrics=callback_metrics,
-> 1507 initial_epoch=initial_epoch)
1508
1509 def evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None):
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/keras/engine/training.py in _fit_loop(self, f, ins, out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins, shuffle, callback_metrics, initial_epoch)
1154 batch_logs['size'] = len(batch_ids)
1155 callbacks.on_batch_begin(batch_index, batch_logs)
-> 1156 outs = f(ins_batch)
1157 if not isinstance(outs, list):
1158 outs = [outs]
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/keras/backend/theano_backend.py in __call__(self, inputs)
1194 def __call__(self, inputs):
1195 assert isinstance(inputs, (list, tuple))
-> 1196 return self.function(*inputs)
1197
1198
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/theano/compile/function_module.py in __call__(self, *args, **kwargs)
793 s.storage[0] = s.type.filter(
794 arg, strict=s.strict,
--> 795 allow_downcast=s.allow_downcast)
796
797 except Exception as e:
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/theano/tensor/type.py in filter(self, data, strict, allow_downcast)
115 if allow_downcast:
116 # Convert to self.dtype, regardless of the type of data
--> 117 data = theano._asarray(data, dtype=self.dtype)
118 # TODO: consider to pad shape with ones to make it consistent
119 # with self.broadcastable... like vector->row type thing
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/theano/misc/safe_asarray.py in _asarray(a, dtype, order)
32 dtype = theano.config.floatX
33 dtype = np.dtype(dtype) # Convert into dtype object.
---> 34 rval = np.asarray(a, dtype=dtype, order=order)
35 # Note that dtype comparison must be done by comparing their `num`
36 # attribute. One cannot assume that two identical data types are pointers
/home/q/anaconda3/envs/p3/lib/python3.6/site-packages/numpy/core/numeric.py in asarray(a, dtype, order)
529
530 """
--> 531 return array(a, dtype, copy=False, order=order)
532
533
ValueError: Bad input argument to theano function with name "train_function" at index 1 (0-based).
Backtrace when that variable is created:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment