Aharrypotter commented on code in PR #19813:
URL: https://github.com/apache/tvm/pull/19813#discussion_r3427175344
##########
python/tvm/relax/frontend/tflite/tflite_frontend.py:
##########
@@ -1564,6 +1612,26 @@ def convert_relu(self, op):
return out
+ def convert_relu_0_to_1(self, op):
+ """Convert TFLite RELU_0_TO_1."""
+ input_tensors = self.get_input_tensors(op)
+ assert len(input_tensors) == 1, "input tensors length should be 1"
+ input_tensor = input_tensors[0]
+ in_expr = self.get_expr(input_tensor.tensor_idx)
+
+ output_tensors = self.get_output_tensors(op)
+ assert len(output_tensors) == 1, "output tensors length should be 1"
+ output_tensor = output_tensors[0]
+
+ if input_tensor.qnn_params:
+ in_f32 = self.dequantize(in_expr, input_tensor)
+ out = relax.op.clip(in_f32, min=0, max=1)
+ out = self.quantize(out, output_tensor)
+ else:
+ out = relax.op.clip(in_expr, min=0, max=1)
Review Comment:
Addressed by switching the new `relax.op.clip` calls to positional arguments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]