Apply the ReLU activation to tensor x: replace every negative element with 0, leaving non-negative elements unchanged.
x
Input
tensor([-2.0000, -0.5000, 0.0000, 1.5000, 3.0000])
Output
tensor([0.0000, 0.0000, 0.0000, 1.5000, 3.0000])
This one's part of Premium. Unlock the full PyTorch track plus every other premium problem on the site.
solve(...)