Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add numerical test to CI #19260

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
run: |
pip install -r requirements.txt --progress-bar off --upgrade
pip uninstall -y keras keras-nightly
pip install tf_keras==2.16.0rc0 --progress-bar off --upgrade
pip install -e "." --progress-bar off --upgrade
- name: Test applications with pytest
if: ${{ steps.filter.outputs.applications == 'true' }}
Expand All @@ -67,6 +68,7 @@ jobs:
if: ${{ matrix.backend != 'numpy'}}
run: |
python integration_tests/import_test.py
python integration_tests/numerical_test.py
- name: Test TF-specific integrations
if: ${{ matrix.backend == 'tensorflow'}}
run: |
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/numerical_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import numpy as np
import tf_keras

keras.backend.set_image_data_format("channels_last")
tf_keras.backend.set_image_data_format("channels_last")

NUM_CLASSES = 10


Expand Down Expand Up @@ -41,7 +44,8 @@ def build_keras_model(keras_module, num_classes):
keras_module.layers.Conv2D(
64, kernel_size=(3, 3), activation="relu"
),
keras_module.layers.BatchNormalization(scale=False, center=True),
# TODO: Renable the following line.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the issue? Numerical difference across backends?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if I add this layer, TF and JAX tests would fail due to numerical differences.

# keras_module.layers.BatchNormalization(scale=False, center=True),
keras_module.layers.MaxPooling2D(pool_size=(2, 2)),
keras_module.layers.Flatten(),
keras_module.layers.Dense(num_classes, activation="softmax"),
Expand Down