MCPcopy Index your code
hub / github.com/apache/tvm / test_rpc

Function test_rpc

tests/python/contrib/test_random.py:124–143  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

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.

Callers 1

test_random_fillFunction · 0.70

Calls 5

printFunction · 0.85
get_global_funcMethod · 0.80
ServerMethod · 0.80
check_remoteFunction · 0.70
enabledMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…