Return True if we can safely cast in_type to out_type
Parameters : | in_type : numpy type
out_dtype : numpy type
has_intercept : bool, optional
has_slope : bool, optional
|
---|---|
Returns : | tf : bool
|
Examples
>>> can_cast(np.float64, np.float32)
True
>>> can_cast(np.complex128, np.float32)
False
>>> can_cast(np.int64, np.float32)
True
>>> can_cast(np.float32, np.int16)
False
>>> can_cast(np.float32, np.int16, False, True)
True
>>> can_cast(np.int16, np.uint8)
False
>>> can_cast(np.int16, np.uint8, False, True)
False
>>> can_cast(np.int16, np.uint8, True, True)
True