masahi commented on a change in pull request #5194: [PYTORCH]Activations for
pytorch
URL: https://github.com/apache/incubator-tvm/pull/5194#discussion_r401326602
##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -335,6 +335,53 @@ def forward(self, *args):
input_data = torch.rand(input_shape).float()
verify_model(ReLU1().float().eval(), input_data=input_data)
+def test_forward_prelu():
+ torch.set_grad_enabled(False)
+ input_shape = [1, 3, 10, 10]
+
+ class PReLU1(Module):
+ def __init__(self):
+ super(PReLU1, self).__init__()
+ self.prelu = torch.nn.PReLU(num_parameters=3)
+ def forward(self, *args):
+ return self.prelu(args[0])
+
+ input_data = torch.rand(input_shape).float()
+ verify_model(PReLU1().float().eval(), input_data=input_data)
+
+def test_forward_leakyrelu():
+ torch.set_grad_enabled(False)
+ input_shape = [10, 10]
+
+ class LeakyReLU1(Module):
+ def forward(self, *args):
+ return torch.nn.LeakyReLU(negative_slope=0.05)(args[0])
+
+ input_data = torch.rand(input_shape).float()
+ verify_model(LeakyReLU1().float().eval(), input_data=input_data)
+
+def test_forward_elu():
+ torch.set_grad_enabled(False)
+ input_shape = [10, 10]
+
+ class ELU1(Module):
+ def forward(self, *args):
+ return torch.nn.ELU(alpha=1.3)(args[0])
+
+ input_data = torch.rand(input_shape).float()
+ verify_model(ELU1().float().eval(), input_data=input_data)
+
+def test_forward_log_sigmoid():
+ torch.set_grad_enabled(False)
+ input_shape = [10, 10]
+
+ class LogSigmoid1(Module):
+ def forward(self, *args):
+ return torch.nn.LogSigmoid()(args[0])
+
+ input_data = torch.rand(input_shape).float()
+ verify_model(LogSigmoid1().float().eval(), input_data=input_data)
+
Review comment:
New tests shouldn't add these wrapper classes. Use the torch modules
directly. See
https://github.com/apache/incubator-tvm/blob/430cb89995bff298cca0adf6ef1087d071875d1a/tests/python/frontend/pytorch/test_forward.py#L771-L781
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services