CanCastΒΆ

Returns True if cast between data types can occur according to the casting rule.

Abstract Signature:

CanCast(from_: DType | Tensor, to: DType, casting: str = safe)

PyTorch

API: torch.can_cast
Strategy: Direct Mapping

JAX (Core)

API: jax.numpy.can_cast
Strategy: Direct Mapping

NumPy

API: numpy.can_cast
Strategy: Direct Mapping