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

Function test_softplus_activation

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

Source from the content-addressed store, hash-verified

111
112
113def test_softplus_activation(N=50):
114 from numpy_ml.neural_nets.activations import SoftPlus
115
116 N = np.inf if N is None else N
117
118 mine = SoftPlus()
119 gold = lambda z: F.softplus(torch.FloatTensor(z)).numpy()
120
121 i = 0
122 while i < N:
123 n_dims = np.random.randint(1, 100)
124 z = random_stochastic_matrix(1, n_dims)
125 assert_almost_equal(mine.fn(z), gold(z))
126 print("PASSED")
127 i += 1
128
129
130def test_elu_activation(N=50):

Callers

nothing calls this directly

Calls 3

fnMethod · 0.95
SoftPlusClass · 0.90
random_stochastic_matrixFunction · 0.90

Tested by

no test coverage detected