MCPcopy Create free account
hub / github.com/onnxsim/onnxsim / forward

Method forward

tests/test_python_api.py:61–69  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

59 super(WithSubGraph, self).__init__()
60
61 def forward(self, x):
62 if x.sum() > 1.0:
63 # NOTE: even onnxsim cannot simplify it,
64 # a canonical pass in onnx-optimizer is needed for it.
65 # so this test only tests that include_subgraph doesn't
66 # result in invalid model in this case
67 return 3 + x + 3
68 else:
69 return x + 4
70
71 net = torch.jit.script(WithSubGraph())
72 dummy_input = torch.randn(2)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected