- qspec. check_shape ( shape , *args , allow_scalar=True , return_mode=False )[source]
-
Check whether all arguments have the specified shape.
- Parameters:
-
- shapetuple
The shape which must be matched by the specified arguments.
- argsndarray
The arguments which must match the specified shape.
- allow_scalarbool
Whether scalar values (
shape == ()) are seen as compatible with arbitrary shapes.- return_modebool
Whether to return
Falseinstead of raising aValueErrorif any argument does not have shapeshape.
- Returns:
-
- matchbool | None
Whether the arguments match the specified shape.
- Raises:
-
- ValueError
If any argument does not match the specified shape and
return_modeisFalse.