(dtype)
| 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): |
| 126 | print("skip because extern function is not available") |
| 127 | return |
| 128 | if not tvm.testing.device_enabled("rpc") or not tvm.runtime.enabled("llvm"): |
| 129 | return |
| 130 | |
| 131 | def check_remote(server): |
| 132 | remote = rpc.connect(server.host, server.port) |
| 133 | value = tvm.runtime.empty((512, 512), dtype, remote.cpu()) |
| 134 | random_fill = remote.get_function("tvm.contrib.random.random_fill") |
| 135 | random_fill(value) |
| 136 | |
| 137 | assert np.count_nonzero(value.numpy()) == 512 * 512 |
| 138 | |
| 139 | # make sure arithmentic doesn't overflow too |
| 140 | np_values = value.numpy() |
| 141 | assert np.isfinite(np_values * np_values + np_values).any() |
| 142 | |
| 143 | check_remote(rpc.Server("127.0.0.1")) |
| 144 | |
| 145 | # Packed sub-byte dtypes (e.g. int4) are intentionally unsupported by |
| 146 | # random_fill since #19714 and raise an error instead. |
no test coverage detected
searching dependent graphs…