Skip to content

tenzr::txpr::CustomVJPFunction

Callable wrapper that applies a function decorated with a registered custom VJP rule.

#include <custom_vjp.h>

Public Functions

Name
CustomVJPFunction(std::string name, std::function< Array(const Array &)> fn, std::function< std::pair< Array, Array >(const Array &)> fwd, std::function< Array(const Array &, const Array &)> bwd)
Array operator()(const Array & x) const

Public Functions Documentation

function CustomVJPFunction

CustomVJPFunction(
    std::string name,
    std::function< Array(const Array &)> fn,
    std::function< std::pair< Array, Array >(const Array &)> fwd,
    std::function< Array(const Array &, const Array &)> bwd
)

Parameters:

  • name Function name.
  • fn Eager forward implementation.
  • fwd Forward rule used under tracing.
  • bwd Backward rule.

Create a named custom-VJP function and register its forward/backward rules.

function operator()

Array operator()(
    const Array & x
) const