tenzr::UFuncRegistry¶
Process-wide registry of named ufuncs, including the standard built-ins.
#include <ufunc.h>
Public Functions¶
| Name | |
|---|---|
| UFuncRegistry & | Instance() The process-wide singleton registry. |
| void | RegisterUfunc(std::shared_ptr< UFunc > ufunc) Register (or replace) ufunc by name. |
| std::shared_ptr< UFunc > | Find(const std::string & name) const Find the ufunc named name, or nullptr when absent. |
| bool | Has(const std::string & name) const Whether a ufunc named name is registered. |
| Tensor | Add(const Tensor & a, const Tensor & b) |
| Tensor | Subtract(const Tensor & a, const Tensor & b) |
| Tensor | Multiply(const Tensor & a, const Tensor & b) |
| Tensor | Divide(const Tensor & a, const Tensor & b) |
| Tensor | Negative(const Tensor & a) |
| Tensor | Absolute(const Tensor & a) |
| Tensor | Exponential(const Tensor & a) |
| Tensor | Logarithm(const Tensor & a) |
| Tensor | SquareRoot(const Tensor & a) |
| Tensor | Sin(const Tensor & a) |
| Tensor | Cos(const Tensor & a) |
| Tensor | tanh(const Tensor & a) |
| Tensor | sigmoid(const Tensor & a) |
Public Functions Documentation¶
function Instance¶
The process-wide singleton registry.
Return: Reference to the singleton UFuncRegistry.
Get the process-wide ufunc registry.
function RegisterUfunc¶
Register (or replace) ufunc by name.
Parameters:
- ufunc Ufunc to register; must not be null.
Add or replace a ufunc, keyed by its name.
function Find¶
Find the ufunc named name, or nullptr when absent.
Parameters:
- name Ufunc name.
Return: The ufunc, or nullptr when absent.
Look up a ufunc by name.
function Has¶
Whether a ufunc named name is registered.
Parameters:
- name Ufunc name.
Return: true when present.
Test whether a ufunc is registered.
function Add¶
Parameters:
- a Left operand.
- b Right operand.
Return: a + b.
Elementwise addition.
function Subtract¶
Parameters:
- a Left operand.
- b Right operand.
Return: a - b.
Elementwise subtraction.
function Multiply¶
Parameters:
- a Left operand.
- b Right operand.
Return: a * b.
Elementwise multiplication.
function Divide¶
Parameters:
- a Left operand.
- b Right operand.
Return: a / b.
Elementwise division.
function Negative¶
Parameters:
- a Input tensor.
Return: -a.
Elementwise negation.
function Absolute¶
Parameters:
- a Input tensor.
Return: |a|.
Elementwise absolute value.
function Exponential¶
Parameters:
- a Input tensor.
Return: exp(a).
Elementwise exponential.
function Logarithm¶
Parameters:
- a Input tensor.
Return: log(a).
Elementwise natural logarithm.
function SquareRoot¶
Parameters:
- a Input tensor.
Return: sqrt(a).
Elementwise square root.
function Sin¶
Parameters:
- a Input tensor.
Return: sin(a).
Elementwise sine.
function Cos¶
Parameters:
- a Input tensor.
Return: cos(a).
Elementwise cosine.
function tanh¶
Parameters:
- a Input tensor.
Return: tanh(a).
Elementwise hyperbolic tangent.
function sigmoid¶
Parameters:
- a Input tensor.
Return: sigmoid(a).
Elementwise logistic sigmoid.