Skip to content

Handle Keras 3 tensor metadata in TF2 models#4

Open
kiwigitops wants to merge 1 commit into
apple:mainfrom
kiwigitops:fix-keras3-tensor-metadata
Open

Handle Keras 3 tensor metadata in TF2 models#4
kiwigitops wants to merge 1 commit into
apple:mainfrom
kiwigitops:fix-keras3-tensor-metadata

Conversation

@kiwigitops

Copy link
Copy Markdown

Summary

  • read TF2 tensor dtype and shape from type_spec when available, with a Keras 3 fallback to dtype and shape
  • normalize tensor metadata through TensorFlow before building ResponseInfo
  • use layer metadata when Keras 3 output names are generic, so Conv2D responses still classify correctly

Fixes #2

Tests

  • $env:PYTHONPATH='src/dnikit;src/dnikit_tensorflow'; python -m pytest -o addopts= src/dnikit_tensorflow/tests/test_tf2_model_loaders.py::test_get_tensor_dtype_and_shape_without_type_spec src/dnikit_tensorflow/tests/test_tf2_model_loaders.py::test_convert_tf_operation_uses_layer_metadata_when_output_name_is_generic src/dnikit_tensorflow/tests/test_tf2_model_loaders.py::test_tf_load_from_memory -q
  • python -m compileall -q src/dnikit_tensorflow/dnikit_tensorflow/_tensorflow/_tf2_model.py src/dnikit_tensorflow/tests/test_tf2_model_loaders.py
  • git diff --check

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when running a Sample notebook

1 participant