(N=15)
| 502 | |
| 503 | |
| 504 | def 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 | |
| 524 | def test_elu_grad(N=15): |
nothing calls this directly
no test coverage detected