Open Table Of Contents

numba.decorators

numba.decorators.autojit(template_signature=None, backend='ast', target='cpu', nopython=False, locals=None, **kwargs)

Creates a function that dispatches to type-specialized LLVM functions based on the input argument types. If no specialized function exists for a set of input argument types, the dispatcher creates and caches a new specialized function at call time.

numba.decorators.jit(restype=None, argtypes=None, backend='ast', target='cpu', nopython=False, **kws)

Compile a function given the input and return types.

There are multiple ways to specify the type signature:

  • Using the restype and argtypes arguments, passing Numba types.
  • By constructing a Numba function type and passing that as the first argument to the decorator. You can create a function type by calling an exisiting Numba type, which is the return type, and the arguments to that call define the argument types. For example, f8(f8) would create a Numba function type that takes a single double-precision floating point value argument, and returns a double-precision floating point value.
  • As above, but using a string instead of a constructed function type. Example: jit("f8(f8)").

If backend=’bytecode’ the bytecode translator is used, if backend=’ast’ the AST translator is used. By default, the AST translator is used. Note that the bytecode translator is deprecated as of the 0.3 release.

numba.decorators.export(signature, env_name=None, env=None, **kws)

Construct a decorator that takes a function and exports one

A signature is a string with

name ret_type(arg_type, argtype, ...)

numba.decorators.exportmany(signatures, env_name=None, env=None, **kws)

A Decorator that exports many signatures for a single function