Fix deprecation warning in sigmoid
This commit is contained in:
@@ -2,13 +2,11 @@ import torch
|
||||
from torch.nn import functional
|
||||
|
||||
def parse_functional(functional_config):
|
||||
if functional_config is None:
|
||||
return None
|
||||
elif isinstance(functional_config, str):
|
||||
if isinstance(functional_config, str):
|
||||
if functional_config == 'relu':
|
||||
return functional.relu
|
||||
elif functional_config == 'sigmoid':
|
||||
return functional.sigmoid
|
||||
return torch.sigmoid
|
||||
elif functional_config == 'softmax':
|
||||
return functional.softmax
|
||||
|
||||
return None
|
||||
@@ -24,7 +24,11 @@ def test_constructor():
|
||||
phi_config["output_dim"] = 2
|
||||
phi_config["final_activation"] = "sigmoid"
|
||||
phi = ds.Phi.from_config(phi_config)
|
||||
assert phi.final_activation == torch.nn.functional.sigmoid
|
||||
assert phi.final_activation == torch.sigmoid
|
||||
|
||||
phi_config["final_activation"] = "relu"
|
||||
phi = ds.Phi.from_config(phi_config)
|
||||
assert phi.final_activation == torch.nn.functional.relu
|
||||
|
||||
def test_phi():
|
||||
input_dim = 5
|
||||
|
||||
Reference in New Issue
Block a user