Skip to content

Feedback about Introduction to torch.compile - A little typo #3804

@CellBro

Description

@CellBro

There is the following issue on this page: https://docs.pytorch.org/tutorials/intermediate/torch_compile_tutorial.html

In the section explaining the behavior of torch.compile when running the function bar multiple times with different if branches, there is a minor inaccuracy in the description of the cached graph.

The current text states:

"We do not see a graph of x = a / (torch.abs(a) + 1) outputted the second time since torch.compile cached this graph from the first run and re-used it."

However, in the description of the first run, the traced graph was explicitly listed as:

"1. x = a / (torch.abs(a) + 1); b.sum()"

Omitting b.sum() in the description of the cached graph (the second run) creates a slight inconsistency. As a reader, I was momentarily confused about whether b.sum() was part of the cached computation or if it was handled differently, since it was present in the first graph description but missing in the second.

This small change ensures the description of the cached graph matches the initial traced graph, preventing confusion about the b.sum() operation.
I'm new to torch.compile, The tutorial helps a lot !👍Thank you for the great tutorial!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions