plaidml: TypeError: Cannot cast scalar from dtype('O') to dtype(' I’ve been trying to get a LSTM based project up and running with PlainML.
I’m getting: TypeError: Cannot cast scalar from dtype('O') to dtype('<f4') according to the rule 'same_kind'
error when running with PlaidML backend - this includes OpenCL / Metal / LLVM on all of: CPU / Intel Graphics 630 / AMD Radeon Pro 560X.
This error does not appear when simply running with Keras.
(env) $ python run_all.py
Using plaidml.keras.backend backend.
INFO:plaidml:Opening device "metal_amd_radeon_pro_560x.0 / opencl_amd_amd_radeon_pro_560x_compute_engine.0"
Compilation Time (s) : 0.00164794921875
Train on 2393 samples, validate on 423 samples
Traceback (most recent call last):
File "run_all.py", line 121, in <module>
results_config = run.run_configuration ([...])
File "xxx/dev/run.py", line 107, in run_configuration
model.fit(xs_norm[:,:,1:], ys_norm[:,1], batch_size=batch_size, epochs=epochs,
validation_split=validation_split, callbacks=[esCallBack], shuffle=False)
File "xxx/env/lib/python3.7/site-packages/keras/engine/training.py", line 1039, in fit
validation_steps=validation_steps)
File "xxx/env/lib/python3.7/site-packages/keras/engine/training_arrays.py", line 199, in fit_loop
outs = f(ins_batch)
File "xxx/env/lib/python3.7/site-packages/plaidml/keras/backend.py", line 165, in __call__
val = variable(val, dtype=self._input_types[name]).var
File "xxx/env/lib/python3.7/site-packages/plaidml/keras/backend.py", line 1669, in variable
view.copy_from_ndarray(value)
File "xxx/env/lib/python3.7/site-packages/plaidml/__init__.py", line 1174, in copy_from_ndarray
np.copyto(dst, src)
TypeError: Cannot cast scalar from dtype('O') to dtype('<f4') according to the rule 'same_kind'
Here are examples of the values given to model.fit
:
xs_norm[:,:,1:]: ... // type: <class 'numpy.ndarray'>
ys_norm[:,1]: ... // type: <class 'numpy.ndarray'>
batch_size: 32 // type: <class 'int'>
epochs: 1000 // type: <class 'int'>
validation_split: 0.15 // type: <class 'float'>
[esCallBack]: [<keras.callbacks.EarlyStopping object at 0x135838898>] // type: <class 'list'>
I’ve been trying to get a LSTM based project up and running with PlainML.
I’m getting: TypeError: Cannot cast scalar from dtype('O') to dtype('<f4') according to the rule 'same_kind'
error when running with PlaidML backend - this includes OpenCL / Metal / LLVM on all of: CPU / Intel Graphics 630 / AMD Radeon Pro 560X.
This error does not appear when simply running with Keras.
(env) $ python run_all.py
Using plaidml.keras.backend backend.
INFO:plaidml:Opening device "metal_amd_radeon_pro_560x.0 / opencl_amd_amd_radeon_pro_560x_compute_engine.0"
Compilation Time (s) : 0.00164794921875
Train on 2393 samples, validate on 423 samples
Traceback (most recent call last):
File "run_all.py", line 121, in <module>
results_config = run.run_configuration ([...])
File "xxx/dev/run.py", line 107, in run_configuration
model.fit(xs_norm[:,:,1:], ys_norm[:,1], batch_size=batch_size, epochs=epochs,
validation_split=validation_split, callbacks=[esCallBack], shuffle=False)
File "xxx/env/lib/python3.7/site-packages/keras/engine/training.py", line 1039, in fit
validation_steps=validation_steps)
File "xxx/env/lib/python3.7/site-packages/keras/engine/training_arrays.py", line 199, in fit_loop
outs = f(ins_batch)
File "xxx/env/lib/python3.7/site-packages/plaidml/keras/backend.py", line 165, in __call__
val = variable(val, dtype=self._input_types[name]).var
File "xxx/env/lib/python3.7/site-packages/plaidml/keras/backend.py", line 1669, in variable
view.copy_from_ndarray(value)
File "xxx/env/lib/python3.7/site-packages/plaidml/__init__.py", line 1174, in copy_from_ndarray
np.copyto(dst, src)
TypeError: Cannot cast scalar from dtype('O') to dtype('<f4') according to the rule 'same_kind'
Here are examples of the values given to model.fit
:
xs_norm[:,:,1:]: ... // type: <class 'numpy.ndarray'>
ys_norm[:,1]: ... // type: <class 'numpy.ndarray'>
batch_size: 32 // type: <class 'int'>
epochs: 1000 // type: <class 'int'>
validation_split: 0.15 // type: <class 'float'>
[esCallBack]: [<keras.callbacks.EarlyStopping object at 0x135838898>] // type: <class 'list'>
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 2
- Comments: 18
Also experiencing this bug. Works fine on Keras w/o PlaidML.
Relevant code snips follow below:
Logs: