(N=50)
| 148 | |
| 149 | |
| 150 | def test_relu_activation(N=50): |
| 151 | from numpy_ml.neural_nets.activations import ReLU |
| 152 | |
| 153 | N = np.inf if N is None else N |
| 154 | |
| 155 | mine = ReLU() |
| 156 | gold = lambda z: F.relu(torch.FloatTensor(z)).numpy() |
| 157 | |
| 158 | i = 0 |
| 159 | while i < N: |
| 160 | n_dims = np.random.randint(1, 100) |
| 161 | z = random_stochastic_matrix(1, n_dims) |
| 162 | assert_almost_equal(mine.fn(z), gold(z)) |
| 163 | print("PASSED") |
| 164 | i += 1 |
| 165 | |
| 166 | |
| 167 | def test_selu_activation(N=50): |
nothing calls this directly
no test coverage detected