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