Per-op metadata record stored by pointer in the OpRegistry.
Schemas are intended to be constexpr statics defined alongside each
op implementation; the registry stores raw pointers and assumes the
pointee outlives the registry (true for process-lifetime statics).
Constructing schemas with dynamic storage duration is supported but
discouraged.
Attributes
namestd::string_viewCanonical op name; used as the
OpRegistry key and in diagnostic / error messages. Must point into storage that lives at least as long as the registry (constexpr literals are ideal).versionintMonotonic schema version starting at 1. Bump on backwards- incompatible changes — bumping invalidates checkpoints / traces that reference the previous version.
amp_policyAmpPolicyHow this op responds to an active autocast context. See
AmpPolicy for the three values.deterministicbooltrue if the op produces bit-identical results given identical inputs and configuration. false for ops that rely on atomics, non-associative parallel reductions, or other sources of run-to-run variation. Consulted by check_schema_determinism / SchemaGuard when Determinism::is_enabled().determinism_notestd::string_viewHuman-readable explanation of why the op is non-deterministic (e.g.
"uses atomic scatter-add"). Included verbatim in the error message raised under set_deterministic(True). Empty for deterministic ops.input_arityintExpected number of input tensors.
-1 means variadic (the op accepts any number of inputs; the op is responsible for its own arity validation).output_arityintNumber of output tensors produced. Defaults to
1; most ops are single-output.stable_input_indicesstd::vector<int>Indices into the input list whose values are saved for backward. Autograd's version-counter logic uses these to detect illegal in-place mutations between forward and backward that would corrupt the saved tensors.
internalbooltrue for ops that are not part of the public Python API (implementation-detail kernels, fused / internal helpers). The Python binding layer hides these from dir(lucid) etc.Constructors
1Minimal constructor for deterministic ops with default arity.
Parameters
nstd::string_viewCanonical op name.
vintSchema version (start at 1).
apAmpPolicyAMP dispatch policy.
detbool, default= trueDeterminism flag.
notestd::string_view, default= ""Non-determinism explanation; ignored when
det is true.Notes
Leaves input_arity = -1 (variadic), output_arity = 1,
stable_input_indices empty, and internal = false. Use the
full constructor below when these defaults are not appropriate.