mlx.core.can_cast

目录

mlx.core.can_cast#

can_cast(from_: array | Dtype, to: Dtype) bool#

Determine if one data type can be cast to another according to type promotion rules.

from_ can be cast to to if promoting the two together gives back to.

参数:
  • from (array or Dtype) -- The source array or dtype.

  • to (Dtype) -- The destination dtype.

返回:

Whether the cast can be performed.

返回类型:

bool