Skip to content

Improvement in courses/udacity_intro_to_tensorflow_for_deep_learning/l02c01_celsius_to_fahrenheit.ipynb - #523

Closed
bogaktik wants to merge 3 commits into
tensorflow:masterfrom
bogaktik:update-Sequential-usage
Closed

bogaktik wants to merge 3 commits into
tensorflow:masterfrom
bogaktik:update-Sequential-usage

Conversation

@bogaktik

@bogaktik bogaktik commented Nov 1, 2026

Copy link
Copy Markdown

Description

This PR updates the TensorFlow Keras Sequential model definition to adhere to the modern standards of Keras 3 / TensorFlow 2.16+.

Historically, input_shape was passed directly inside the first core layer (Dense). In newer versions of Keras, this triggers a UserWarning. To resolve this, the network architecture has been refactored to explicitly use a dedicated tf.keras.Input layer as the first element in the sequential definition.

Changes

  • Refactored model instantiation to include tf.keras.Input(shape=(1,)) followed by tf.keras.layers.Dense(units=1).
  • Silenced the runtime UserWarning during notebook execution.

Verification

  • Tested compiling, training (model.fit), and evaluating the updated model.

… Input layer

Updated the Sequential model definition to use `tf.keras.Input(shape=(1,))` instead of passing `input_shape` directly to the `Dense` layer, aligning with Keras 3/TensorFlow 2.16+ standards
@bogaktik
bogaktik requested a review from MarkDaoust as a code owner November 1, 2026 23:50
@google-ml-butler google-ml-butler Bot added the size:M CL Change Size: Medium label Nov 1, 2026
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@bogaktik bogaktik changed the title refactor: resolve Keras 3 input_shape deprecation UserWarning refactor: resolve Keras 3 input_shape deprecation UserWarning in courses/udacity_intro_to_tensorflow_for_deep_learning/l02c01_celsius_to_fahrenheit.ipynb Nov 4, 2026
Resolve 'ValueError: Unrecognized data type' in Keras 3 by wrapping
the input prediction list `[100.0]` into a NumPy array `np.array([100.0])`.
@bogaktik bogaktik changed the title refactor: resolve Keras 3 input_shape deprecation UserWarning in courses/udacity_intro_to_tensorflow_for_deep_learning/l02c01_celsius_to_fahrenheit.ipynb Improvement in courses/udacity_intro_to_tensorflow_for_deep_learning/l02c01_celsius_to_fahrenheit.ipynb Nov 4, 2026
- refactor: replace input_shape with tf.keras.Input for Keras 3 compatibility
@bogaktik bogaktik closed this Nov 4, 2026
@bogaktik
bogaktik deleted the update-Sequential-usage branch November 4, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M CL Change Size: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant