(N=50)
| 182 | |
| 183 | |
| 184 | def test_leakyrelu_activation(N=50): |
| 185 | from numpy_ml.neural_nets.activations import LeakyReLU |
| 186 | |
| 187 | N = np.inf if N is None else N |
| 188 | |
| 189 | i = 0 |
| 190 | while i < N: |
| 191 | n_dims = np.random.randint(1, 100) |
| 192 | z = random_stochastic_matrix(1, n_dims) |
| 193 | alpha = np.random.uniform(0, 10) |
| 194 | |
| 195 | mine = LeakyReLU(alpha=alpha) |
| 196 | gold = lambda z: F.leaky_relu(torch.FloatTensor(z), alpha).numpy() |
| 197 | assert_almost_equal(mine.fn(z), gold(z)) |
| 198 | |
| 199 | print("PASSED") |
| 200 | i += 1 |
| 201 | |
| 202 | |
| 203 | def test_gelu_activation(N=50): |
nothing calls this directly
no test coverage detected