ekalda commented on a change in pull request #9530:
URL: https://github.com/apache/tvm/pull/9530#discussion_r754433475
##########
File path: tests/python/contrib/test_ethosu/test_type_inference.py
##########
@@ -374,5 +375,32 @@ def test_ethosu_invalid_dtype():
run_opt_pass(func, relay.transform.InferType())
[email protected](
+ "ifm_shape, ifm_layout", [((1, 4, 5, 33), "NHWC"), ((1, 4, 3, 5, 16),
"NHCWB16")]
+)
[email protected](
+ "ofm_shape, ofm_layout", [((1, 4, 5, 33), "NHWC"), ((1, 4, 3, 5, 16),
"NHCWB16")]
+)
+def test_ethosu_unary_elementwise_type_inference(
+ ifm_shape,
+ ifm_layout,
+ ofm_shape,
+ ofm_layout,
+):
+ ifm = relay.var("ifm", shape=ifm_shape, dtype="int8")
+ operator_type = "ABS"
+ ofm_channels = 33
+ unary_elementwise = make_ethosu_unary_elementwise(
+ ifm,
+ ofm_channels,
+ operator_type,
+ ifm_layout=ifm_layout,
+ ofm_layout=ofm_layout,
+ )
+ f = relay.Function([ifm], unary_elementwise)
+ f = run_opt_pass(f, relay.transform.InferType())
+ assert tuple(f.body.checked_type.shape) == ofm_shape
+
+
Review comment:
> Should ABS have a rounding mode as implemented in #9514?
Yes, well spotted, I added the `rounding_mode` attribute :)
--
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]