MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / test_normal

Method test_normal

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

Source from the content-addressed store, hash-verified

314 np.testing.assert_array_equal(Tensor.randint(16, low=5, high=6).numpy(), 5)
315
316 def test_normal(self):
317 self.assertTrue(normal_test(Tensor.normal))
318 self.assertTrue(equal_distribution(Tensor.normal, lambda x: torch.nn.init.normal_(torch.empty(x), mean=0, std=1),
319 lambda x: np.random.normal(loc=0, scale=1, size=x)))
320 # check std >= 0
321 with self.assertRaises(ValueError): Tensor.normal((3, 4), mean=0, std=-1)
322
323 def test_uniform(self):
324 self.assertFalse(normal_test(Tensor.uniform))

Callers

nothing calls this directly

Calls 4

normal_testFunction · 0.85
equal_distributionFunction · 0.85
normalMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected