Skip to content
fn

register_custom_function

void register_custom_function(int & m)

Register the custom-function bindings into a pybind11 module.

Exposes three Python-visible names under the receiving module:

  • FunctionCtx — opaque shared-pointer class with save_for_backward(*tensors), the saved_tensors property, and permissive __setattr__ / __getattr__ for extras.
    • _PythonBackwardNode — internal Node subclass with read/write ctx and backward_fn fields.
    • _register_python_backward_node(output, node, inputs) — wires node into the autograd graph as output's grad_fn, materialising AccumulateGrad nodes for any leaves that need them and recording version counters for in-place mutation checks.

See Also

lucid.autograd._python_node — Python-side caller of _register_python_backward_node.

Parameters

mpy::module_&
The pybind11 module to register into. Called once during engine module initialisation.