8000 Aligns Float32 Relu6 Evaluation with QuantizedRelu Evaluation and ele… · IBMZ-Linux-OSS-Python/tensorflow@de9b872 · GitHub
[go: up one dir, main page]

Skip to content

Commit de9b872

Browse files
Aligns Float32 Relu6 Evaluation with QuantizedRelu Evaluation and element shape/size check
PiperOrigin-RevId: 766303656
1 parent ddff116 commit de9b872

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tensorflow/lite/kernels/activations.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -914,11 +914,9 @@ TfLiteStatus Relu6Eval(TfLiteContext* context, TfLiteNode* node) {
914914
ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data);
915915
switch (input->type) {
916916
case kTfLiteFloat32: {
917-
size_t elements = input->bytes / sizeof(float);
918-
const float* in = GetTensorData<float>(input);
919-
const float* in_end = in + elements;
920-
float* out = GetTensorData<float>(output);
921-
for (; in < in_end; in++, out++) *out = std::min(std::max(0.f, *in), 6.f);
917+
reference_ops::Relu6(GetTensorShape(input), GetTensorData<float>(input),
918+
GetTensorShape(output),
919+
GetTensorData<float>(output));
922920
return kTfLiteOk;
923921
}
924922
case kTfLiteUInt8:

0 commit comments

Comments
 (0)
0