torch.ShapeErrorMessage
export type ShapeErrorMessage<S extends Shape> = S extends {
readonly [ShapeError]: infer Msg extends string;
}
? `SHAPE_ERROR: ${Msg}`
: never;Sextends ShapeExtract the error message from a shape error type as a string literal. Used by ValidTensor to produce readable compile-time error messages.
Examples
type Msg = ShapeErrorMessage<matmul_error_inner_dimensions_do_not_match<3, 5, [2,3], [5,4]>>;
// = "SHAPE_ERROR: matmul_error_inner_dimensions_do_not_match<3, 5>"