Add files via upload
This commit is contained in:
parent
fdefd448ef
commit
f7ef47738e
1 changed files with 5 additions and 1 deletions
|
@ -32,7 +32,11 @@ class SoftmaxPower(torch.nn.Module):
|
|||
self.no_input_mode = False
|
||||
|
||||
def forward(self, input: torch.Tensor) -> torch.Tensor:
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue