(N=15)
| 440 | |
| 441 | |
| 442 | def test_softmax_activation(N=15): |
| 443 | from numpy_ml.neural_nets.layers import Softmax |
| 444 | |
| 445 | np.random.seed(12345) |
| 446 | |
| 447 | N = np.inf if N is None else N |
| 448 | |
| 449 | mine = Softmax() |
| 450 | gold = lambda z: F.softmax(torch.FloatTensor(z), dim=1).numpy() |
| 451 | |
| 452 | i = 0 |
| 453 | while i < N: |
| 454 | n_dims = np.random.randint(1, 100) |
| 455 | z = random_stochastic_matrix(1, n_dims) |
| 456 | assert_almost_equal(mine.forward(z), gold(z)) |
| 457 | print("PASSED") |
| 458 | i += 1 |
| 459 | |
| 460 | |
| 461 | def test_relu_activation(N=15): |
nothing calls this directly
no test coverage detected