Set mutable to True by default in nnx_metadata by divyashreepathihalli · Pull Request #22074 · keras-team/keras (original) (raw)

@divyashreepathihalli

[gemini-code-assist[bot]](/apps/gemini-code-assist)

hertschuh

sachinprasadhs pushed a commit to sachinprasadhs/keras that referenced this pull request

Jan 29, 2026

@divyashreepathihalli @sachinprasadhs

hertschuh added a commit that referenced this pull request

Jan 30, 2026

Keras never uses this feature.

Added safe mode checks for loading TFSMLayer from external SavedModels.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

Enable unsafe deserialization for TFSM Layer tests.

The safe_mode check should only be in from_config(), not init().

Direct instantiation (TFSMLayer(filepath=...)) is a legitimate use case where the user explicitly creates the layer. The security concern is only during deserialization of untrusted .keras files, which goes through from_config().

This allows attackers to create malicious .keras files while still blocking victims from loading them with safe_mode=True.

Add comprehensive tests for TFSMLayer safe_mode behavior:

Updated test docstrings for clarity on instantiation and loading behavior.

Added model invocation with random input to tests for TFSMLayer.

Changes in format

Also re-added empty lines.


Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Fabien Hertschuh 1091026+hertschuh@users.noreply.github.com


Co-authored-by: sarvesh patil 103917093+HyperPS@users.noreply.github.com Co-authored-by: hertschuh 1091026+hertschuh@users.noreply.github.com Co-authored-by: Divyashree Sreepathihalli divyashreepathihalli@gmail.com Co-authored-by: Manan Patel 70314133+0xManan@users.noreply.github.com Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

jerryxyj added a commit to jerryxyj/keras that referenced this pull request

Feb 14, 2026

@jerryxyj

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})