AndrewZhaoLuo commented on a change in pull request #8426:
URL: https://github.com/apache/tvm/pull/8426#discussion_r666521774
##########
File path: tests/python/frontend/onnx/test_forward.py
##########
@@ -4872,6 +4872,48 @@ def test_qlinearadd():
verify_qlinearadd([5, 1, 7], [2, 7], [5, 2, 7])
+def get_random_uniform(shape, dtype="float32", high=1.0, low=0.0, seed=None,
target="llvm"):
+ ONNX_DTYPE = mapping.NP_TYPE_TO_TENSOR_TYPE[np.dtype(dtype)]
+ node = helper.make_node(
+ "RandomUniform", [], ["out"], shape=shape, dtype=ONNX_DTYPE,
high=high, low=low
+ )
+ if seed is not None:
+ seed_attr = helper.make_attribute("seed", seed)
+ node.attribute.append(seed_attr)
+
+ graph = helper.make_graph(
+ [node],
+ "random_uniform_test",
+ inputs=[],
+ outputs=[helper.make_tensor_value_info("out", ONNX_DTYPE, shape)],
+ )
+ model = helper.make_model(graph, producer_name="random_uniform_test")
+ return get_tvm_output_with_vm(model, [], target=target,
device=tvm.device(target, 0))
+
+
+def test_random_uniform():
Review comment:
Can we also have a test which matches against a golden vector/tensor?
I think actually testing for a uniform random distribution is really hard
but having a golden vector/tensor at least shows to a user things look
uniformly random for one seeded value.
--
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]