lhutton1 commented on code in PR #13848:
URL: https://github.com/apache/tvm/pull/13848#discussion_r1088297238
##########
tests/python/contrib/test_ethosn/test_addition.py:
##########
@@ -41,20 +41,28 @@ def _get_model(
):
"""Return a model and any parameters it may have"""
- iinfo = np.iinfo(dtype)
- data_min = iinfo.min
- data_max = iinfo.max
+ def create_or_assign_constant(shape, dtype, default_data):
+ """Creates new numpy array or assigns default_data if available."""
+
+ iinfo = np.iinfo(dtype)
+ data_min = iinfo.min
+ data_max = iinfo.max
+
+ nparray = None
+ if default_data:
+ nparray = np.array(default_data, dtype=dtype).reshape(shape)
+ else:
+ nparray = np.random.randint(data_min, data_max + 1, size=shape,
dtype=dtype)
+
+ return relay.const(nparray, dtype=dtype)
if lhs_is_constant:
- a_data = np.array(constant_data, dtype=dtype).reshape(lhs_shape)
- a = relay.const(a_data, dtype=dtype)
+ a = create_or_assign_constant(lhs_shape, dtype, constant_data)
else:
a = relay.var("a", shape=lhs_shape, dtype=dtype)
if rhs_is_constant:
- b_data = np.array(constant_data, dtype=dtype).reshape(rhs_shape)
- np.random.randint(data_min, data_max + 1, size=rhs_shape, dtype=dtype)
Review Comment:
Thanks for fixing this - looks much better!
##########
tests/python/contrib/test_ethosn/test_networks.py:
##########
@@ -218,6 +218,6 @@ def test_ssd_mobilenet_v1():
input_dict={"normalized_input_image_tensor": (1, 300, 300, 3)},
compile_hash=_compile_hash,
output_count=4,
- host_ops=26,
+ host_ops=14,
Review Comment:
😱
--
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]