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

Function test_elu_activation

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

Source from the content-addressed store, hash-verified

418
419
420def test_elu_activation(N=15):
421 from numpy_ml.neural_nets.activations import ELU
422
423 np.random.seed(12345)
424
425 N = np.inf if N is None else N
426
427 i = 0
428 while i < N:
429 n_dims = np.random.randint(1, 10)
430 z = random_tensor((1, n_dims))
431
432 alpha = np.random.uniform(0, 10)
433
434 mine = ELU(alpha)
435 gold = lambda z, a: F.elu(torch.from_numpy(z), alpha).numpy()
436
437 assert_almost_equal(mine.fn(z), gold(z, alpha))
438 print("PASSED")
439 i += 1
440
441
442def test_softmax_activation(N=15):

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
random_tensorFunction · 0.90
ELUClass · 0.90

Tested by

no test coverage detected