a
    yn„f�  ã                   @  sJ   d dl mZ d dlZd dlmZ d dlmZ dZeƒ dd„ ƒZ	dd	„ Z
dS )
é    )ÚannotationsN)Ú
JaxBackend)Úhigh_level_function)Úto_jaxc                 c  s   | fV  t | ƒS )a)  
    Args:
        array: Array-like data (anything #ak.to_layout recognizes).

    Converts `array` (many types supported) into a JAX Device Array, if possible.

    If the data are numerical and regular (nested lists have equal lengths
    in each dimension, as described by the #ak.Array.type), they can be losslessly
    converted to a JAX array and this function returns without an error.

    Otherwise, the function raises an error.

    If `array` is a scalar, it is converted into a JAX scalar.

    See also #ak.from_jax and #ak.to_numpy.
    )Ú_impl)Úarray© r   ú_/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/awkward/operations/ak_to_jax.pyr      s    r   c                 C  s,   t j| dd�}t ¡ }| |¡}|jdd�S )NF)Zallow_record)Zallow_missing)ÚakZ	to_layoutr   ÚinstanceZ
to_backendZto_backend_array)r   ZlayoutÚbackendZnumpy_layoutr   r   r	   r   %   s    
r   )Ú
__future__r   Zawkwardr
   Zawkward._backends.jaxr   Zawkward._dispatchr   Ú__all__r   r   r   r   r   r	   Ú<module>   s   
