Skip to content

refactor: resolve Keras 3 input_shape deprecation UserWarning - #523

Open
bogaktik wants to merge 1 commit into
tensorflow:masterfrom
bogaktik:update-Sequential-usage
Open

bogaktik wants to merge 1 commit 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review size:M CL Change Size: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant