MCPcopy
hub / github.com/tinygrad/tinygrad / sample_three

Method sample_three

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

Source from the content-addressed store, hash-verified

384 w = [0.1, 0.2, 0.3, 0.4]
385 @TinyJit
386 def sample_three(): return Tensor(w).multinomial(3, replacement=False).realize()
387
388 tiny_draws = np.array([sample_three().numpy() for _ in range(400)])
389 torch_draws = np.array([torch.tensor(w).multinomial(3, replacement=False).numpy() for _ in range(400)])

Callers

nothing calls this directly

Calls 3

TensorClass · 0.90
realizeMethod · 0.80
multinomialMethod · 0.80

Tested by

no test coverage detected