(dev, dtype)
| 108 | """Tests random_fill function""" |
| 109 | |
| 110 | def test_local(dev, dtype): |
| 111 | if not tvm.get_global_func("tvm.contrib.random.random_fill", True): |
| 112 | print("skip because extern function is not available") |
| 113 | return |
| 114 | value = tvm.runtime.empty((512, 512), dtype, dev) |
| 115 | random_fill = tvm.get_global_func("tvm.contrib.random.random_fill") |
| 116 | random_fill(value) |
| 117 | |
| 118 | assert np.count_nonzero(value.numpy()) == 512 * 512 |
| 119 | |
| 120 | # make sure arithmentic doesn't overflow too |
| 121 | np_values = value.numpy() |
| 122 | assert np.isfinite(np_values * np_values + np_values).any() |
| 123 | |
| 124 | def test_rpc(dtype): |
| 125 | if not tvm.get_global_func("tvm.contrib.random.random_fill", True): |
no test coverage detected
searching dependent graphs…