Skip to content

Commit f1f42ff

Browse files
authored
Add None activation
1 parent 6eece8c commit f1f42ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

segmentation_models_pytorch/base/encoder_decoder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, encoder, decoder, activation):
1010
self.encoder = encoder
1111
self.decoder = decoder
1212

13-
if callable(activation):
13+
if callable(activation) or activation is None:
1414
self.activation = activation
1515
elif activation == 'softmax':
1616
self.activation = nn.Softmax(dim=1)
@@ -30,6 +30,7 @@ def predict(self, x):
3030

3131
with torch.no_grad():
3232
x = self.forward(x)
33-
x = self.activation(x)
33+
if self.activation:
34+
x = self.activation(x)
3435

3536
return x

0 commit comments

Comments
 (0)