I am trying to implement a custom activation function (the codes attached below). Before using the custom activation function, everything works well. However, as long as it is used, the server would throw the error:
The error always appears at the first epoch.
I am using
- Pytorch 1.1.0
- Cuda compilation tools, release 9.2, V9.2.148
c = 1.33 b = 0.4 p = 6.88 input_size = x.shape num = torch.numel(x) # the element number of the input tensor x = x.view(num) out = torch.zeros(len(x)) for i in range(len(x)): if x[i] < 0: out[i] = 0 else: out[i] = (c * x[i]) / (1 + torch.mul(b * p, torch.pow(x[i], p))) out = out.view(input_size, input_size, input_size, input_size) return out