torchwrench.types.guards module¶
- torchwrench.types.guards.is_integral_dtype(dtype: dtype | None | 'default' | str | DTypeEnum) bool[source]¶
- torchwrench.types.guards.is_number_like(x: Any) TypeGuard[bool | int | float | complex | ndarray | number | Tensor0D][source]¶
Returns True if input is a scalar number.
Accepted numbers-like objects are: - Python numbers (int, float, bool, complex) - Numpy zero-dimensional arrays - Numpy numbers - PyTorch zero-dimensional tensors
- torchwrench.types.guards.is_scalar_like(x: Any) TypeGuard[bool | int | float | complex | None | str | bytes | ndarray | generic | Tensor0D][source]¶
Returns True if input is a scalar number.
Accepted scalar-like objects are: - Python scalars like (int, float, bool, complex, None, str, bytes) - Numpy zero-dimensional arrays - Numpy generic - PyTorch zero-dimensional tensors