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

Function test_relu_activation

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

Source from the content-addressed store, hash-verified

148
149
150def 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
167def test_selu_activation(N=50):

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
ReLUClass · 0.90
random_stochastic_matrixFunction · 0.90

Tested by

no test coverage detected