passing np array to predict function #506
Open
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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