MCPcopy
hub / github.com/tinygrad/tinygrad / test_rand_like_zero_shape

Method test_rand_like_zero_shape

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

Source from the content-addressed store, hash-verified

235 assert rand.device == empty.device
236
237 def test_rand_like_zero_shape(self):
238 empty = Tensor.empty(0, 20)
239 rand = Tensor.rand_like(empty)
240 assert rand.shape == empty.shape
241 assert rand.dtype == empty.dtype
242 assert rand.device == empty.device
243
244 def test_rand_like_more_dims(self):
245 empty = Tensor.empty((1, 2, 3, 4, 5, 6))

Callers

nothing calls this directly

Calls 2

rand_likeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected