returnn.frontend._native

Native code as Python extension module for the RETURNN frontend, including tensor methods and ops.

returnn.frontend._native.get_module(*, verbose: bool = False)[source]
Returns:

native Python extension module

returnn.frontend._native.set_enabled(enabled: bool)[source]

Enable or disable the native code setup. Overwrites the global setting.

Parameters:

enabled

returnn.frontend._native.is_enabled() bool[source]

If set_enabled() was called, returns that. Otherwise, check env var, global config. Otherwise, default to True.

returnn.frontend._native.is_set_up() bool[source]
Returns:

whether the native code is set up

returnn.frontend._native.setup()[source]

Setup the native code.

returnn.frontend._native.setup_torch()[source]

Like setup(), but specifically for the PyTorch backend. This assumes that we can import torch, unlike setup().