Skip to content

Commit

Permalink
Mobile upgrader: add GELU test modules
Browse files Browse the repository at this point in the history
Test Plan: This is test code

Reviewed By: tugsbayasgalan

Differential Revision: D33858429

fbshipit-source-id: f5bc687ad81125f89cb281f9aa51dc5ac74d6954
(cherry picked from commit 202dff607e72d538c8b3fcd44382d11a401e52c5)
  • Loading branch information
jbschlosser authored and cyyever committed Feb 17, 2022
1 parent 8279379 commit 5423409
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Binary file added test/jit/fixtures/test_versioned_gelu_out_v9.ptl
Binary file not shown.
Binary file added test/jit/fixtures/test_versioned_gelu_v9.ptl
Binary file not shown.
15 changes: 15 additions & 0 deletions test/jit/fixtures_srcs/fixtures_src.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ def __init__(self):

def forward(self, a: Union[int, float, complex], b: Union[int, float, complex], out: torch.Tensor):
return torch.logspace(a, b, out=out)

class TestVersionedGeluV9(torch.nn.Module):
def __init__(self):
super().__init__()

def forward(self, x):
return torch._C._nn.gelu(x)

class TestVersionedGeluOutV9(torch.nn.Module):
def __init__(self):
super().__init__()

def forward(self, x):
out = torch.zeros_like(x)
return torch._C._nn.gelu(x, out=out)
2 changes: 2 additions & 0 deletions test/jit/fixtures_srcs/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def div_Tensor_0_3(self: Tensor, other: Tensor) -> Tensor:
TestVersionedLinspaceOutV7(): "aten::linspace.out",
TestVersionedLogspaceV8(): "aten::logspace",
TestVersionedLogspaceOutV8(): "aten::logspace.out",
TestVersionedGeluV9(): "aten::gelu",
TestVersionedGeluOutV9(): "aten::gelu.out",
}

"""
Expand Down

0 comments on commit 5423409

Please sign in to comment.