Fix hardswish test for ubsan.

PiperOrigin-RevId: 311645688
Change-Id: Id9f3b31da09355c9997f3f2cc95dca5954c956ec
This commit is contained in:
Renjie Liu 2020-05-14 18:19:41 -07:00 committed by TensorFlower Gardener
parent 4662933489
commit 377612c026
1 changed files with 1 additions and 1 deletions

View File

@ -2597,7 +2597,7 @@ inline void HardSwish(const HardSwishParams& params,
// significant bits in the high bits of our 16-bit fixedpoint values, so // significant bits in the high bits of our 16-bit fixedpoint values, so
// that fixed-point approximate computations below are as accurate as // that fixed-point approximate computations below are as accurate as
// possible. // possible.
const int16_t input_value_on_hires_input_scale = input_value << 7; const int16_t input_value_on_hires_input_scale = input_value * (1 << 7);
// Compute the input value on essentially the output scale, just not // Compute the input value on essentially the output scale, just not
// right-shifted yet. This is the value that we'll use in the (x >= +3) // right-shifted yet. This is the value that we'll use in the (x >= +3)
// case, and that in the general case we'll multiply against the "relu-ish" // case, and that in the general case we'll multiply against the "relu-ish"