MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / test_softplus_activation

Function test_softplus_activation

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

Source from the content-addressed store, hash-verified

478
479
480def test_softplus_activation(N=15):
481 from numpy_ml.neural_nets.activations import SoftPlus
482
483 np.random.seed(12345)
484
485 N = np.inf if N is None else N
486
487 mine = SoftPlus()
488 gold = lambda z: F.softplus(torch.FloatTensor(z)).numpy()
489
490 i = 0
491 while i < N:
492 n_dims = np.random.randint(1, 100)
493 z = random_stochastic_matrix(1, n_dims)
494 assert_almost_equal(mine.fn(z), gold(z))
495 print("PASSED")
496 i += 1
497
498
499#######################################################################

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
SoftPlusClass · 0.90
random_stochastic_matrixFunction · 0.90

Tested by

no test coverage detected