
    Whg                        d dl mZ d dlZd dlZd dlmZmZ d dlm	Z	 eZ
eZeZ G d dej                  Zde_        eej        ej        eeeef         Zde_        eeej        ef         Zd	e_        dS )
    )annotationsN)AnyUnion)Sequencec                     e Zd ZdZdgZdZeej        dd                        Z	eej        dd                        Z
eej        dd	                        Zeej        dd                        Zej        dd            Zeej        dd                        Zeej        dd                        Zeej        dd                        Zeej        dd                        Zeej        d d                        Zeej        dd                        Zeej        d!d                        Zej        d             ZdS )"Arraya  Array base class for JAX

  ``jax.Array`` is the public interface for instance checks and type annotation
  of JAX arrays and tracers. Its main applications are in instance checks and
  type annotations; for example::

    x = jnp.arange(5)
    isinstance(x, jax.Array)  # returns True both inside and outside traced functions.

    def f(x: Array) -> Array:  # type annotations are valid for traced and non-traced types.
      return x

  ``jax.Array`` should not be used directly for creation of arrays; instead you
  should use array creation routines offered in :mod:`jax.numpy`, such as
  :func:`jax.numpy.array`, :func:`jax.numpy.zeros`, :func:`jax.numpy.ones`,
  :func:`jax.numpy.full`, :func:`jax.numpy.arange`, etc.
  __weakref__Nreturnnp.dtypec                    dS )z2The data type (:class:`numpy.dtype`) of the array.N selfs    X/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/jax/_src/basearray.pydtypezArray.dtype:             intc                    dS )z&The number of dimensions in the array.Nr   r   s    r   ndimz
Array.ndim?   r   r   c                    dS )z*The total number of elements in the array.Nr   r   s    r   sizez
Array.sizeD   r   r   tuple[int, ...]c                    dS )zThe shape of the array.Nr   r   s    r   shapezArray.shapeI   r   r   indexc                    dS )z>Return an array of the addressable data at a particular index.Nr   )r   r   s     r   addressable_datazArray.addressable_dataO   r   r   Sequence[Shard]c                    dS )zList of addressable shards.Nr   r   s    r   addressable_shardszArray.addressable_shardsS   r   r   c                    dS )zList of global shards.Nr   r   s    r   global_shardszArray.global_shardsX   r   r   boolc                    dS )a  Is this Array fully addressable?

    A jax.Array is fully addressable if the current process can address all of
    the devices named in the :class:`Sharding`. ``is_fully_addressable`` is
    equivalent to "is_local" in multi-process JAX.

    Note that fully replicated is not equal to fully addressable i.e.
    a jax.Array which is fully replicated can span across multiple hosts and is
    not fully addressable.
    Nr   r   s    r   is_fully_addressablezArray.is_fully_addressable]   r   r   c                    dS )zIs this Array fully replicated?Nr   r   s    r   is_fully_replicatedzArray.is_fully_replicatedk   r   r   Shardingc                    dS )zThe sharding for the array.Nr   r   s    r   shardingzArray.shardingp   r   r   c                    dS )at  Whether the array is committed or not.

    An array is committed when it is explicitly placed on device(s) via JAX
    APIs. For example, `jax.device_put(np.arange(8), jax.devices()[0])` is
    committed to device 0. While `jax.device_put(np.arange(8))` is uncommitted
    and will be placed on the default device.

    Computations involving some committed inputs will happen on the committed
    device(s) and the result will be committed on the same device(s).
    Invoking an operation on arguments that are committed to different device(s)
    will raise an error.

    For example:

    ```
    a = jax.device_put(np.arange(8), jax.devices()[0])
    b = jax.device_put(np.arange(8), jax.devices()[1])
    a + b  # Raises an error
    ```

    See https://jax.readthedocs.io/en/latest/faq.html#controlling-data-and-computation-placement-on-devices
    for more information.
    Nr   r   s    r   	committedzArray.committedu   r   r   Device | Shardingc                    dS )zArray API-compatible device attribute.

    For single-device arrays, this returns a Device. For sharded arrays, this
    returns a Sharding.
    Nr   r   s    r   devicezArray.device   r   r   c                    dS )a  Copies an ``Array`` to the host asynchronously.

    For arrays that live an an accelerator, such as a GPU or a TPU, JAX may
    cache the value of the array on the host. Normally this happens
    behind the scenes when the value of an on-device array is requested by the
    user, but waiting to initiate a device-to-host copy until the value is
    requested requires that JAX block the caller while waiting for the copy to
    complete.

    ``copy_to_host_async`` requests that JAX populate its on-host cache of an
    array, but does not wait for the copy to complete. This may speed up a
    future on-host access to the array's contents.
    Nr   r   s    r   copy_to_host_asynczArray.copy_to_host_async   r   r   )r
   r   )r
   r   )r
   r   )r   r   r
   r   )r
   r   )r
   r$   )r
   r)   )r
   r.   )__name__
__module____qualname____doc__	__slots____hash__propertyabcabstractmethodr   r   r   r   r   r!   r#   r&   r(   r+   r-   r0   r2   r   r   r   r   r       sk        , o)(= = =  8= 1 1 1  81 5 5 5  85 " " "  8" I I I I & & &  8& ! ! !  8! 
 
 
  8
 * * *  8* & & &  8&     82     8     r   r   jaxz2Type annotation for JAX-compatible static scalars.z+Type annotation for JAX array-like objects.)
__future__r   r:   numpynptypingr   r   collections.abcr   DeviceShardr)   ABCr   r4   bool_numberr$   r   floatcomplexStaticScalarr6   ndarray	ArrayLiker   r   r   <module>rL      s  " # " " " " " 



             $ $ $ $ $ $ 

G G G G GCG G G GT   (BIUG L  *	
 B	   r   