GB6183

Graph-Break Type

Short name describing what triggered the graph break

torch.map: f mutates a captured tensor

Context

Values or code snippet captured at the break point

freevars={freevars_mutated}

Explanation

Explanation of why the graph break was triggered

map only supports in-place mutation of xs. A tensor captured from the enclosing scope (lifted parameter) is loop-invariant: every iteration sees the same tensor, so a mutation makes iterations depend on each other, breaking map’s independence contract and introducing a data race under any parallel lowering. Pass the buffer through xs, or use scan / while_loop if sequential buffer updates are required.

Hints

Hints on how to resolve the graph break

Additional Information

Click here to add Additional Info

Back to Registry