Docs / nablatensor-ops / com.nablatensor.ops

final class

CustomOp

A registry for user-named operations, in macro form: a custom op is a function that expands into primitive ADouble nodes when it is recorded. Its adjoint is whatever the recorded sub-graph produces, so it works on every backend with no engine change (Seam 3, composable subset).

CustomOp.registerUnary("softplus", (rec, x) -> Smooth.ramp(rec, x, 0.05));
SDouble y = CustomOp.unary("softplus").apply(rec, x);

A fused op with a hand-written {forward(x), adjoint(x, gbar)} and per-backend code generation — for kernels that cannot be expressed in the primitive set at all — is a later engine feature. For everything expressible as a composition (which is most of what a quant registers) this form is equivalent and needs nothing from the engine.

Methods

static void registerUnary(String name, Unary op)
static void registerBinary(String name, Binary op)
static Unary unary(String name)
static Binary binary(String name)
static boolean hasUnary(String name)