Add files via upload

This commit is contained in:
David Rotermund 2023-07-25 00:57:03 +02:00 committed by GitHub
parent fdefd448ef
commit f7ef47738e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,7 +32,11 @@ class SoftmaxPower(torch.nn.Module):
self.no_input_mode = False
def forward(self, input: torch.Tensor) -> torch.Tensor:
output: torch.Tensor = torch.abs(input).pow(self.power)
if self.power != 0.0:
output: torch.Tensor = torch.abs(input).pow(self.power)
else:
output: torch.Tensor = torch.exp(input)
if self.dim is None:
output = output / output.sum()
else: