MCPcopy
hub / github.com/ddbourgin/numpy-ml / test_sigmoid_grad

Function test_sigmoid_grad

numpy_ml/tests/test_nn.py:504–521  ·  view source on GitHub ↗
(N=15)

Source from the content-addressed store, hash-verified

502
503
504def test_sigmoid_grad(N=15):
505 from numpy_ml.neural_nets.activations import Sigmoid
506
507 np.random.seed(12345)
508
509 N = np.inf if N is None else N
510
511 mine = Sigmoid()
512 gold = torch_gradient_generator(torch.sigmoid)
513
514 i = 0
515 while i < N:
516 n_ex = np.random.randint(1, 100)
517 n_dims = np.random.randint(1, 100)
518 z = random_tensor((n_ex, n_dims))
519 assert_almost_equal(mine.grad(z), gold(z))
520 print("PASSED")
521 i += 1
522
523
524def test_elu_grad(N=15):

Callers

nothing calls this directly

Calls 4

gradMethod · 0.95
SigmoidClass · 0.90
random_tensorFunction · 0.90
torch_gradient_generatorFunction · 0.70

Tested by

no test coverage detected