(N=50)
| 111 | |
| 112 | |
| 113 | def test_softplus_activation(N=50): |
| 114 | from numpy_ml.neural_nets.activations import SoftPlus |
| 115 | |
| 116 | N = np.inf if N is None else N |
| 117 | |
| 118 | mine = SoftPlus() |
| 119 | gold = lambda z: F.softplus(torch.FloatTensor(z)).numpy() |
| 120 | |
| 121 | i = 0 |
| 122 | while i < N: |
| 123 | n_dims = np.random.randint(1, 100) |
| 124 | z = random_stochastic_matrix(1, n_dims) |
| 125 | assert_almost_equal(mine.fn(z), gold(z)) |
| 126 | print("PASSED") |
| 127 | i += 1 |
| 128 | |
| 129 | |
| 130 | def test_elu_activation(N=50): |
nothing calls this directly
no test coverage detected