Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONNX] Add silu operator support for onnx #51193

Merged
merged 2 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/onnx/test_pytorch_onnx_onnxruntime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4346,6 +4346,18 @@ def forward(self, x):
dynamic_axes={'x': [1, 2]},
test_with_inputs=[y])

def test_silu(self):
class SiLUModel(torch.nn.Module):
def __init__(self):
super(SiLUModel, self).__init__()
self.silu = torch.nn.SiLU()

def forward(self, x):
return self.silu(x)

x = torch.randn(2, 3, 4)
self.run_test(SiLUModel(), (x))

def test_remainder(self):
class RemainderModel(torch.nn.Module):
def forward(self, input, other):
Expand Down
4 changes: 4 additions & 0 deletions torch/onnx/symbolic_opset9.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,10 @@ def prelu(g, self, weight):
return g.op("PRelu", self, weight)


def silu(g, input):
return g.op('Mul', input, g.op('Sigmoid', input))


def relu(g, input):
return g.op("Relu", input)

Expand Down