MCPcopy Index your code
hub / github.com/pytorch/tutorials / bar_fixed

Function bar_fixed

intermediate_source/torch_compile_tutorial.py:372–383  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

370
371@torch.compile(fullgraph=True)
372def bar_fixed(a, b):
373 x = a / (torch.abs(a) + 1)
374
375 def true_branch(y):
376 return y * -1
377
378 def false_branch(y):
379 # NOTE: torch.cond doesn't allow aliased outputs
380 return y.clone()
381
382 b = cond(b.sum() < 0, true_branch, false_branch, (b,))
383 return x * b
384
385
386bar_fixed(inp1, inp2)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected