compile

ivy.compile(func: Callable, dynamic: bool = True, example_inputs: Optional[Union[Any, Tuple[Any]]] = None, static_argnums: Optional[Union[int, Iterable[int]]] = None, static_argnames: Optional[Union[int, Iterable[int]]] = None, f: Optional[ivy.Framework] = None) → Callable[source]

Provide a function which should be compiled, for faster inference. The handle to the newly compiled function is returned.

Parameters
  • func (callable) – Function to be compiled.

  • dynamic (bool, default True) – Whether to compile all conditional branches, regardless of inputs during first invocation.

  • example_inputs (single input or tuple of inputs.) – Example of inputs to the function to be compiled. Required for torch in non-dynamic mode, unused by other frameworks.

  • static_argnums (int or sequence of ints, optional) – The argument numbers which should be treated as static for compiling. Default is None.

  • static_argnames (str or sequence of strs, optional) – The argument names which should be treated as static for compiling. Default is None.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

The handle to the newly compiled function.


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty