Skip to content

TensorFlow unit test failure kernels:requantize_op_test on AARCH64 #52152

Closed

Description

@elfringham

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): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): git HEAD
  • Python version: 3.6.9
  • Bazel version (if compiling from source): 3.7.2
  • GCC/Compiler version (if compiling from source): 10.3.0
  • CUDA/cuDNN version: n/a
  • GPU model and memory: n/a

You can collect some of this information using our environment capture
script
You can also obtain the TensorFlow version with:

  1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
  2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior

Test fails

Describe the expected behavior

Test passes

Contributing

  • Do you want to contribute a PR? (yes/no): No
  • Briefly describe your candidate solution(if contributing):

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/Jupyter/any notebook.

bazel test //tensorflow/core/kernels:requantize_op_test

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.

[ RUN ] RequantizeTest.HandCraftedRequantize
tensorflow/core/framework/tensor_testutil.cc:128: Failure
Value of: IsEqual(Tx[i], Ty[i], t)
Actual: false (128 not equal to 127)
Expected: true
i = 1
[ FAILED ] RequantizeTest.HandCraftedRequantize (37 ms)

Activity

  1. elfringham commented on Sep 27, 2021

    @elfringham
    ContributorAuthor
  2. elfringham commented on Sep 27, 2021

    @elfringham
    ContributorAuthor

    In the inline function RequantizeManyInNewRangeUsingEigen<qint32, quint8> in

    (input_offset_fp - output_offset_fp + rounding_delta);
    you can see the use of rounding_delta. This causes a 'round to nearest' operation when converting from int32 to uint8. In the test the intermediate value of 127.5 results in an output of 128 when the test is run on x86 and uses this code.
    However on AARCH64 the requantize is done by https://github.com/google/gemmlowp and you can see in the verification code that a simple cast is done https://github.com/google/gemmlowp/blob/f9959600daa42992baace8a49544a00a743ce1b6/meta/test_transform_correctness.cc#L85 which uses truncation, no rounding. This means that a different result is obtained. In this test the intermediate value of 127.5 is truncated to 127. This fails the comparison against the expected 128 and the test fails.

  3. added
    comp:core
    stat:awaiting tensorflower
    on Oct 5, 2021
  4. elfringham commented on Jan 7, 2022

    @elfringham
    ContributorAuthor

    Fixed by #53630

  5. google-ml-butler commented on Jan 7, 2022

    @google-ml-butler

    Are you satisfied with the resolution of your issue?
    Yes
    No

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

Metadata

Metadata

Labels

2.6.0comp:corestat:awaiting tensorflowertype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions