PyreFly Lab

PyTorch Static Tensor Shape Type Checker

Static dimensional constraint verification inspired by PyTorch Conf 2026
Static Shape Constraint Verification CHECKING
✓ Static Type Verification Passed: All dimensional constraints and einsum products sound.
Static Verification Status: Sound (0 Type Errors)
Active Contract: Tensor[B=4, S=128, D=512] -> MultiHeadAttention -> Tensor[B=4, S=128, D=512]
PEP 695 / PyreFly Type Stub
Static Assertion Contract
# Generated PyreFly Tensor Contract Stub
from typing import TypeVar
import torch
from torch import Tensor

B = TypeVar("B")  # Batch
S = TypeVar("S")  # Sequence
D = TypeVar("D")  # Dimension
H = TypeVar("H")  # Heads

Tensor dimensions must align before reshape and matrix multiplication

Read the explanation

The educational shape checker divides model dimension by head count and flags a remainder. Hypothetical dimension five hundred twelve with eight and sixteen heads gives sixty-four and thirty-two elements per head. Bars share four pixels per elements-per-head count. This illustrates static shape arithmetic, not executing a neural model. The source query-key-value projection maps D features to three times D. Hypothetical D five hundred twelve and two hundred fifty-six yield one thousand five hundred thirty-six and seven hundred sixty-eight projected features. Bars share point two pixels per projected feature. A later split requires compatible head dimensions; projection alone does not validate all tensor operations. Attention scores have two sequence dimensions S by S per head. Hypothetical sequence lengths one hundred twenty-eight and sixty-four give sixteen thousand three hundred eighty-four and four thousand ninety-six entries. Bars share point zero two pixels per entry. Doubling sequence length quadruples that matrix size. Full actual Python-stub download, native reset, responsive and first-footer checks preserve the source educational stages. Generated typing/runtime framework claims and untested fault buttons remain separate; no backend model request is made.

Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.