(N=15)
| 418 | |
| 419 | |
| 420 | def test_elu_activation(N=15): |
| 421 | from numpy_ml.neural_nets.activations import ELU |
| 422 | |
| 423 | np.random.seed(12345) |
| 424 | |
| 425 | N = np.inf if N is None else N |
| 426 | |
| 427 | i = 0 |
| 428 | while i < N: |
| 429 | n_dims = np.random.randint(1, 10) |
| 430 | z = random_tensor((1, n_dims)) |
| 431 | |
| 432 | alpha = np.random.uniform(0, 10) |
| 433 | |
| 434 | mine = ELU(alpha) |
| 435 | gold = lambda z, a: F.elu(torch.from_numpy(z), alpha).numpy() |
| 436 | |
| 437 | assert_almost_equal(mine.fn(z), gold(z, alpha)) |
| 438 | print("PASSED") |
| 439 | i += 1 |
| 440 | |
| 441 | |
| 442 | def test_softmax_activation(N=15): |
nothing calls this directly
no test coverage detected