Skip to content

tenzr::txpr::CustomVJPRegistry

Process-wide registry mapping operation names to custom VJP rules.

#include <custom_vjp.h>

Public Functions

Name
CustomVJPRegistry & Instance()
Returns the singleton registry.
void RegisterRule(std::string name, CustomVJPRule rule)
Registers rule under name, replacing any existing rule.
bool HasRule(std::string_view name) const
Returns true if a rule named name is registered.
const CustomVJPRule & GetRule(std::string_view name) const
Returns the rule named name; throws if it is not registered.

Public Functions Documentation

function Instance

static CustomVJPRegistry & Instance()

Returns the singleton registry.

Return: Reference to the singleton registry.

Get the process-wide custom VJP rule registry.

function RegisterRule

void RegisterRule(
    std::string name,
    CustomVJPRule rule
)

Registers rule under name, replacing any existing rule.

Parameters:

  • name Operation name.
  • rule Forward/backward rule pair.

Register a custom VJP rule, creating a passthrough OpDef when the op is unknown.

function HasRule

bool HasRule(
    std::string_view name
) const

Returns true if a rule named name is registered.

Parameters:

  • name Operation name.

Return: true when a rule exists.

Test whether a rule is registered for name.

function GetRule

const CustomVJPRule & GetRule(
    std::string_view name
) const

Returns the rule named name; throws if it is not registered.

Parameters:

  • name Operation name.

Return: The registered rule.

Fetch the registered rule for name, throwing when absent.