(N=15)
| 459 | |
| 460 | |
| 461 | def test_relu_activation(N=15): |
| 462 | from numpy_ml.neural_nets.activations import ReLU |
| 463 | |
| 464 | np.random.seed(12345) |
| 465 | |
| 466 | N = np.inf if N is None else N |
| 467 | |
| 468 | mine = ReLU() |
| 469 | gold = lambda z: F.relu(torch.FloatTensor(z)).numpy() |
| 470 | |
| 471 | i = 0 |
| 472 | while i < N: |
| 473 | n_dims = np.random.randint(1, 100) |
| 474 | z = random_stochastic_matrix(1, n_dims) |
| 475 | assert_almost_equal(mine.fn(z), gold(z)) |
| 476 | print("PASSED") |
| 477 | i += 1 |
| 478 | |
| 479 | |
| 480 | def test_softplus_activation(N=15): |
nothing calls this directly
no test coverage detected