Skip to content

Layers flaky tests with incorrect math results #6543

@mattsoulanille

Description

@mattsoulanille

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Debian
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow.js installed from (npm or script link):
  • TensorFlow.js version (use command below):
  • Browser version: Chrome 102
  • Tensorflow.js Converter Version:

Describe the current behavior
Running layers tests rarely results in flaky math failures like the following.

Chrome 102.0.5005.115 (Linux x86_64) LayersModel.fit() with classWeight cpu {} One output, multi-class, sparse encoding FAILED
	Expected 3.070847272872925 to be close to 5.3727.
	    at <Jasmine>
	    at ../../tfjs-layers/src/engine/training_weighted_test.ts:224:37 <- tfjs/tfjs-layers/src/tfjs-layers_test_bundle.js:45710:43
	    at <Jasmine>
	    at fulfilled (tfjs-layers/src/tfjs-layers_test_bundle.js:41:27)

Chrome 102.0.5005.115 (Linux x86_64) LayersModel.fit() with classWeight cpu {} One output, multi-class, one-hot encoding FAILED
	Expected 3.0704801082611084 to be close to 5.3727.
	    at <Jasmine>
	    at ../../tfjs-layers/src/engine/training_weighted_test.ts:82:37 <- tfjs/tfjs-layers/src/tfjs-layers_test_bundle.js:45593:43
	    at <Jasmine>
	    at fulfilled (tfjs-layers/src/tfjs-layers_test_bundle.js:41:27)

Describe the expected behavior
No math errors.

Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/CodePen/any notebook.

Unfortunately, I have no idea how to reproduce this issue. It seems to rarely happen in CI and locally. I also don't know the seed that was used in the test that failed because we don't log it. I'll create a PR that logs the seed, and we can see if it's caused by test order.

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

layers_flakiness.txt

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions