examples icon indicating copy to clipboard operation
examples copied to clipboard

passing np array to predict function

Open yarinkos opened this issue 1 year ago • 1 comments

In order to fix the following error :

Traceback (most recent call last): File "/dev/examples/courses/hands-on/l02c01_celsius_to_fahrenheit.py", line 31, in <module> print(model.predict([100.0])) File "/dev/examples/.venv/lib/python3.9/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler raise e.with_traceback(filtered_tb) from None File "/dev//examples/.venv/lib/python3.9/site-packages/keras/src/trainers/data_adapters/__init__.py", line 125, in get_data_adapter raise ValueError(f"Unrecognized data type: x={x} (of type {type(x)})") ValueError: Unrecognized data type: x=[100.0] (of type <class 'list'>)

model.predict() function in TensorFlow expects its input to be a NumPy array or a Tensor, not a Python list

yarinkos avatar Dec 08 '24 07:12 yarinkos

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB