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

Function test_relu_activation

numpy_ml/tests/test_nn.py:461–477  ·  view source on GitHub ↗
(N=15)

Source from the content-addressed store, hash-verified

459
460
461def test_relu_activation(N=15):
462 from numpy_ml.neural_nets.activations import ReLU
463
464 np.random.seed(12345)
465
466 N = np.inf if N is None else N
467
468 mine = ReLU()
469 gold = lambda z: F.relu(torch.FloatTensor(z)).numpy()
470
471 i = 0
472 while i < N:
473 n_dims = np.random.randint(1, 100)
474 z = random_stochastic_matrix(1, n_dims)
475 assert_almost_equal(mine.fn(z), gold(z))
476 print("PASSED")
477 i += 1
478
479
480def test_softplus_activation(N=15):

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
ReLUClass · 0.90
random_stochastic_matrixFunction · 0.90

Tested by

no test coverage detected