MCPcopy
hub / github.com/tinygrad/tinygrad / test_rand_like

Method test_rand_like

test/backend/test_randomness.py:223–228  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

221 equal_distribution(lambda *x: Tensor.rand(*x, dtype=dtypes.bfloat16).float(), torch.rand, lambda x: np.random.rand(*x), shape=(2, N, N))
222
223 def test_rand_like(self):
224 empty = Tensor.empty((80, 44))
225 rand = Tensor.rand_like(empty)
226 assert rand.shape == empty.shape
227 assert rand.dtype == empty.dtype
228 assert rand.device == empty.device
229
230 def test_randn_like(self):
231 empty = Tensor.empty((80, 44))

Callers

nothing calls this directly

Calls 2

rand_likeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected