Can_cast
torch_can_cast(from_, to)
from_
: (dtype) The original torch_dtype
.to
: (dtype) The target torch_dtype
.Determines if a type conversion is allowed under PyTorch casting rules described in the type promotion documentation .
if (torch_is_installed()) { torch_can_cast(torch_double(), torch_float()) torch_can_cast(torch_float(), torch_int()) }
Useful links