MCPcopy
hub / github.com/ddbourgin/numpy-ml / test_leakyrelu_activation

Function test_leakyrelu_activation

numpy_ml/tests/test_nn_activations.py:184–200  ·  view source on GitHub ↗
(N=50)

Source from the content-addressed store, hash-verified

182
183
184def 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
203def test_gelu_activation(N=50):

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
random_stochastic_matrixFunction · 0.90
LeakyReLUClass · 0.90

Tested by

no test coverage detected