torch.SafeExpandShape
export type SafeExpandShape<S extends Shape, T extends Shape> =
ExpandShape<S, T> extends { __isShapeError: true }
? DynamicShape
: ExpandShape<S, T> extends readonly number[]
? ExpandShape<S, T>
: DynamicShape;Sextends ShapeTextends ShapeSafe version of ExpandShape that returns DynamicShape on error instead of error type. Useful for method return types where we want to allow invalid shapes at runtime.