I want to use a normalization layer after my fully connected layer.
I saw that there is one in the legacy, but is it possible to use it?
Edit, the following code seems to work:
def l2_norm(self,input):
input_size = input.size()
buffer = torch.pow(input, 2)
normp = torch.sum(buffer, 1).add_(1e-10)
norm = torch.sqrt(normp)
_output = torch.div(input, norm.view(-1, 1).expand_as(input))
output = _output.view(input_size)
return output