Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/pytorch_pfn_extras_tests/onnx_tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,20 @@ def forward(self, x, y):
output_names=["out"],
dynamic_axes={"x": {1: "A"}, "y": {0: "B"}},
)


def test_loop():
@torch.jit.script
def f(x: torch.Tensor):
for _ in range(10):
x = x + 5
return x

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

def forward(self, x: torch.Tensor):
return f(x)

run_model_test(Model(), (torch.randn(2, 7, 17),))