Skip to content

Commit

Permalink
[WIP] [pfto] Add ppe.map test case
Browse files Browse the repository at this point in the history
  • Loading branch information
twata committed Jul 4, 2023
1 parent ef49153 commit 30acedc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 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 @@ -389,3 +389,18 @@ def forward(self, x):
assert len(model.graph.input) == 1
model = run_model_test(Model(), (torch.rand((1,)),), keep_initializers_as_inputs=True)
assert len(model.graph.input) == (2 if persistent else 1)


def test_ppe_map():
torch.manual_seed(100)

class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv = torch.nn.Conv2d(1, 1, 3)

def forward(self, x):
y = self.conv(x)
return list(ppe.map(lambda u: u + 1, y))[0]

run_model_test(Net(), (torch.rand(1, 1, 112, 112),), rtol=1e-03)

0 comments on commit 30acedc

Please sign in to comment.