(N=50)
| 357 | |
| 358 | |
| 359 | def test_softplus_grad(N=50): |
| 360 | from numpy_ml.neural_nets.activations import SoftPlus |
| 361 | |
| 362 | N = np.inf if N is None else N |
| 363 | |
| 364 | mine = SoftPlus() |
| 365 | gold = torch_gradient_generator(F.softplus) |
| 366 | |
| 367 | i = 0 |
| 368 | while i < N: |
| 369 | n_ex = np.random.randint(1, 100) |
| 370 | n_dims = np.random.randint(1, 100) |
| 371 | z = random_tensor((n_ex, n_dims), standardize=True) |
| 372 | assert_almost_equal(mine.grad(z), gold(z)) |
| 373 | print("PASSED") |
| 374 | i += 1 |
| 375 | |
| 376 | |
| 377 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected