jax.Array.astype#

abstract Array.astype(dtype, copy=False, device=None)[原始碼]#

複製陣列並轉換為指定的 dtype。

這是透過 jax.lax.convert_element_type() 實作的,在某些情況下,其行為可能與 numpy.ndarray.astype() 略有不同。 特別是,浮點數到整數和整數到浮點數轉換的細節取決於實作。

參數:
  • self (Array)

  • dtype (DTypeLike | None)

  • copy (bool)

  • device (xc.Device | Sharding | None)

回傳型別:

Array