MCPcopy Create free account
hub / github.com/apache/tvm / CondNestedModel

Class CondNestedModel

tests/python/relax/test_frontend_from_exported_program.py:9256–9270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9254 """Nested cond: a cond inside one of the branches."""
9255
9256 class CondNestedModel(Module):
9257 def forward(self, x):
9258 def true_fn(x):
9259 def inner_true(x):
9260 return x * 2.0
9261
9262 def inner_false(x):
9263 return x * 3.0
9264
9265 return torch.cond(x.sum() > 1, inner_true, inner_false, (x,))
9266
9267 def false_fn(x):
9268 return x - 1.0
9269
9270 return torch.cond(x.sum() > 0, true_fn, false_fn, (x,))
9271
9272 example_args = (torch.randn(3, 4),)
9273 exported_program = export(CondNestedModel(), args=example_args)

Callers 1

test_cond_nestedFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_cond_nestedFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…