(N=15)
| 478 | |
| 479 | |
| 480 | def test_softplus_activation(N=15): |
| 481 | from numpy_ml.neural_nets.activations import SoftPlus |
| 482 | |
| 483 | np.random.seed(12345) |
| 484 | |
| 485 | N = np.inf if N is None else N |
| 486 | |
| 487 | mine = SoftPlus() |
| 488 | gold = lambda z: F.softplus(torch.FloatTensor(z)).numpy() |
| 489 | |
| 490 | i = 0 |
| 491 | while i < N: |
| 492 | n_dims = np.random.randint(1, 100) |
| 493 | z = random_stochastic_matrix(1, n_dims) |
| 494 | assert_almost_equal(mine.fn(z), gold(z)) |
| 495 | print("PASSED") |
| 496 | i += 1 |
| 497 | |
| 498 | |
| 499 | ####################################################################### |
nothing calls this directly
no test coverage detected