comaniac commented on a change in pull request #8810:
URL: https://github.com/apache/tvm/pull/8810#discussion_r694305322
##########
File path: tests/python/relay/test_to_mixed_precision.py
##########
@@ -241,6 +241,28 @@ def test_do_not_convert_arange():
assert tvm.ir.structural_equal(mod, output_mod)
+def test_do_not_convert_summation():
+ """Ops that could involve a large summation are not allowed in fp16."""
+ shape = [1, 3, 16, 16]
+ a = relay.var("a", shape=shape)
+ ops = [
+ relay.sum,
+ relay.mean,
+ relay.nn.global_avg_pool2d,
+ lambda inp: relay.nn.adaptive_avg_pool2d(inp, (1, 1)),
+ ]
+ for op in ops:
+ mod = tvm.IRModule.from_expr(op(a))
+ mod = tvm.relay.transform.InferType()(mod)
+
+ mod_params = {
+ "a": np.random.uniform(-1, 1, size=shape).astype("float32"),
+ }
+
+ output_mod = verify_mixed_precision_output_close(mod, mod_params,
atol=0.0, rtol=0)
Review comment:
Sure. That makes more sense to me.
--
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]