o
    oi'                     @   sR   d Z ddlmZ ddlZddlmZ defddZdefdd	Zdefd
dZdS )z2Module for transpiling Kornia to other frameworks.    )
ModuleTypeN)ivyreturnc                   C      t jtdddS )a  Convert Kornia to JAX.

    Transpiles the Kornia library to JAX using [ivy](https://github.com/ivy-llc/ivy). The transpilation process
    occurs lazily, so the transpilation on a given kornia function/class will only occur when it's called or
    instantiated for the first time. This will make any functions/classes slow when being used for the first time,
    but any subsequent uses should be as fast as expected.

    Return:
        The Kornia library transpiled to JAX

    Example:

    .. highlight:: python
    .. code-block:: python

        import kornia
        jax_kornia = kornia.to_jax()
        import jax
        input = jax.random.normal(jax.random.key(42), shape=(2, 3, 4, 5))
        gray = jax_kornia.color.gray.rgb_to_grayscale(input)

    torchjaxsourcetargetr   	transpilekornia r   r   P/home/ubuntu/.local/lib/python3.10/site-packages/kornia/transpiler/transpiler.pyto_jax   
   r   c                   C   r   )aN  Convert Kornia to NumPy.

    Transpiles the Kornia library to NumPy using [ivy](https://github.com/ivy-llc/ivy). The transpilation process
    occurs lazily, so the transpilation on a given kornia function/class will only occur when it's called or
    instantiated for the first time. This will make any functions/classes slow when being used for the first time,
    but any subsequent uses should be as fast as expected.

    Return:
        The Kornia library transpiled to NumPy

    Example:

    .. highlight:: python
    .. code-block:: python

        import kornia
        np_kornia = kornia.to_numpy()
        import numpy as np
        input = np.random.normal(size=(2, 3, 4, 5))
        gray = np_kornia.color.gray.rgb_to_grayscale(input)

    Note:
        Ivy does not currently support transpiling trainable modules to NumPy.

    r   numpyr   r   r   r   r   r   to_numpy8   s
   r   c                   C   r   )a  Convert Kornia to TensorFlow.

    Transpiles the Kornia library to TensorFlow using [ivy](https://github.com/ivy-llc/ivy). The transpilation process
    occurs lazily, so the transpilation on a given kornia function/class will only occur when it's called or
    instantiated for the first time. This will make any functions/classes slow when being used for the first time,
    but any subsequent uses should be as fast as expected.

    Return:
        The Kornia library transpiled to TensorFlow

    Example:

    .. highlight:: python
    .. code-block:: python

        import kornia
        tf_kornia = kornia.to_tensorflow()
        import tensorflow as tf
        input = tf.random.normal((2, 3, 4, 5))
        gray = tf_kornia.color.gray.rgb_to_grayscale(input)

    r   
tensorflowr   r   r   r   r   r   to_tensorflowY   r   r   )	__doc__typesr   r   kornia.core.externalr   r   r   r   r   r   r   r   <module>   s   !