PyTorch Unit-testing in Python
Since you are asking about PyTorch's capabilities you are not taking advantage of, you might want to use:


torch.linspace(-10,0,300) instead of torch.tensor(np.linspace(-10,0,300))
torch.zeros(5, dtype=torch.long) instead of torch.tensor([0,0,0,0,0])
tensor operations instead of iterating over each element of the tensor in a loop. This might not matter much in unit-tests but is important if you want to get GPU acceleration:

self.assertTrue(torch.equal(tout_leqz, torch.zeros_like(tin_leqz)))