modify-shaped-array-dsl
Installation
SKILL.md
You are modifying Pyrefly's tensor-shape DSL — the logic that computes the output shape of a torch op from its input shapes.
This skill points at code; it does not duplicate it. Read the files below to learn the details. What follows is only the map and the invariant you must uphold (add a unit test).
How the DSL works (the 30-second version)
A shape rule is a Python function in
tensor-shapes/pyrefly-torch-stubs/torch-stubs/_shapes.pyi, decorated with
@type_shape_dsl_function, that computes a type-level value using a restricted
Python subset. Public stubs call the function directly in return annotations,
for example Tensor[reshape(Shape, Target)]. The checker validates and
evaluates these calls; CPython treats the decorator as a runtime no-op.