Skip to content

Commit

Permalink
move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lamroger committed Nov 8, 2023
1 parent cecebbe commit b5fe64c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions test/inductor/test_custom_lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,6 @@ def fn(inp, offsets, max_seq_len):
fn(inp, offsets, max_seq_len), fn_opt(inp, offsets, max_seq_len)
)

def test_unfold_zero_dimension_tensor(self):
def forward(x):
return torch.unfold_copy(dimension=1, input=x,size=0,step=7)

x = torch.rand([1,0], dtype=torch.float32)

y = forward(x)
compiled_y = torch.compile(forward, mode='max-autotune',fullgraph=True)(x)

self.assertEqual(y, compiled_y)


if __name__ == "__main__":
from torch._dynamo.test_case import run_tests
Expand Down
11 changes: 11 additions & 0 deletions test/inductor/test_torchinductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6367,6 +6367,17 @@ def test_zero_dim_reductions(self):

self.assertTrue(torch.allclose(actual, expected, atol=1e-3, rtol=1e-3))

def test_unfold_zero_dimension_tensor(self):
def forward(x):
return torch.unfold_copy(dimension=1, input=x,size=0,step=7)

x = torch.rand([1,0], dtype=torch.float32)

y = forward(x)
compiled_y = torch.compile(forward, fullgraph=True)(x)

self.assertEqual(y, compiled_y)

def test_zero_element_mutation(self):
class CustomModel(nn.Module):
def __init__(self):
Expand Down

0 comments on commit b5fe64c

Please sign in to comment.