- flax.linen.jit(target, variables=True, rngs=True, static_argnums=(), donate_argnums=(), device=None, backend=None, methods=None)#
Lifted version of
target – a
Moduleor a function taking a
Moduleas its first argument.
variables – The variable collections that are lifted. By default all collections are lifted.
rngs – The PRNG sequences that are lifted. By default all PRNG sequences are lifted.
static_argnums – An int or collection of ints specifying which positional arguments to treat as static (compile-time constant). Operations that only depend on static arguments will be constant-folded in Python (during tracing), and so the corresponding argument values can be any Python object. Static arguments should be hashable, meaning both
__eq__are implemented, and immutable. Calling the jitted function with different values for these constants will trigger recompilation. If the jitted function is called with fewer positional arguments than indicated by
static_argnumsthen an error is raised. Arguments that are not arrays or containers thereof must be marked as static. Defaults to ().
donate_argnums – Specify which arguments are “donated” to the computation. It is safe to donate arguments if you no longer need them once the computation has finished. In some cases XLA can make use of donated buffers to reduce the amount of memory needed to perform a computation, for example recycling one of your input buffers to store a result. You should not reuse buffers that you donate to a computation, JAX will raise an error if you try to.
device – This is an experimental feature and the API is likely to change. Optional, the Device the jitted function will run on. (Available devices can be retrieved via
jax.devices().) The default is inherited from XLA’s DeviceAssignment logic and is usually to use
backend – a string representing the XLA backend:
methods – If target is a Module, the methods of Module to jit.
A wrapped version of target, set up for just-in-time compilation.