Pipes
a |> f(args) means f(a, args), and a |> f means f(a). In a stage that is a call, a _ argument (positional or keyword) marks where the input goes instead: x |> add(y, _) means add(y, x). A stage may have at most one _ (E0205).
a |> to T means a to T (Conversions with to).
|> binds more loosely than every other operator. A line that starts with |> continues the line above (Lines and indentation):
y = x
|> layer_norm(over=D)
|> matmul(w1)
|> gelu
Each stage is checked with the previous stage’s result as its input. A diagnostic inside a stage gets a note “in stage N of this pipeline, whose input is [...]”, and the editor shows each stage’s shape.
The stages map, filter, zip and enumerate iterate their input, which can be a size or a range as well as a tensor: see Iterator chains. In a pipe stage, these four names are always the iterator stages.
In the editor, each pipe line ends with an inlay hint of its shape, and hovering the hint shows the type with its diagram. Hovering |> into a built-in that only moves values, such as rearrange, or into a function of your own shows the value before the stage and after it, and hovering -> in a pattern of such a built-in shows the operands and the result: side by side, with an arrow between them. Into a built-in that computes, such as softmax, or on -> in einsum’s or reduce’s pattern, it shows the types before and after on a line and a picture of what it does instead. VS Code draws them as one image; other editors get the text drawings next to each other, with → between them, or one under the other if that would be wider than 120 columns.