torch.ValidateBatchedSquareMatrix
export type ValidateBatchedSquareMatrix<S extends Shape> = S extends readonly [
...infer _Batch extends number[],
infer R extends number,
infer C extends number,
]
? R extends C
? S // Valid batched square matrix
: linalg_error_not_square_matrix<R, C>
: number extends S['length']
? DynamicShape // Dynamic shape
: S['length'] extends 0 | 1
? linalg_error_requires_at_least_2d<S['length']>
: DynamicShape;Sextends ShapeValidate shape is at least 2D with square last two dimensions (for batched linalg). Returns batch + last dim if valid.