![]() |
Q.ANT Native Computing Toolkit 2.3.1
All you need for photonic computing
|
#include <stdint.h>#include <dlpack/dlpack.h>

Go to the source code of this file.
Functions | |
| DLManagedTensorVersioned * | mul_npu (const uint32_t npu_id, DLManagedTensorVersioned const *us, DLManagedTensorVersioned const *vs) |
| Multiplies two 1D Tensors element-wise. | |
| DLManagedTensorVersioned * | calc_scaled_periodic_nl_fprop (const uint32_t npu_id, DLManagedTensorVersioned const *features, DLManagedTensorVersioned const *weights) |
| Calculates a scaled periodic nonlinearity pairwise for all elements of features | |
| DLManagedTensorVersioned * | linear_fprop (const uint32_t npu_id, DLManagedTensorVersioned const *features, DLManagedTensorVersioned const *weights) |
| Performs a linear forward propagation between input features and a weight matrix. | |
| DLManagedTensorVersioned * | mul_npu_f32 (const uint32_t npu_id, DLManagedTensorVersioned const *us, DLManagedTensorVersioned const *vs) |
| Multiplies two 1D Tensors of float32 element-wise. | |
| DLManagedTensorVersioned * | mul_npu_i16 (const uint32_t npu_id, DLManagedTensorVersioned const *us, DLManagedTensorVersioned const *vs) |
| Multiplies two 1D Tensors of int16 element-wise. | |
| DLManagedTensorVersioned * calc_scaled_periodic_nl_fprop | ( | const uint32_t | npu_id, |
| DLManagedTensorVersioned const * | features, | ||
| DLManagedTensorVersioned const * | weights ) |
Calculates a scaled periodic nonlinearity pairwise for all elements of features
and weights
.
The output for each input pair is
, where
is a
- periodic function with values between
and
, similar to a cosine.
| npu_id | The identifier of the NPU on which to perform the operation. |
| features | A 1D tensor with data type bfloat16. |
| weights | A 1D tensor with data type bfloat16, same length as features. |
| DLManagedTensorVersioned * linear_fprop | ( | const uint32_t | npu_id, |
| DLManagedTensorVersioned const * | features, | ||
| DLManagedTensorVersioned const * | weights ) |
Performs a linear forward propagation between input features and a weight matrix.
The operation computes output = features @ weights^T, i.e.:
Note that this is not a plain features @ weights — the weight matrix is implicitly transposed, matching the convention where weights has shape (n_channels_out, n_channels_in).
| npu_id | The identifier of the NPU on which to perform the operation. |
| features | A 2D tensor with data type bfloat16 and shape (n_batches, n_channels_in). |
| weights | A 2D tensor with data type bfloat16 and shape (n_channels_out, n_channels_in). |
| DLManagedTensorVersioned * mul_npu | ( | const uint32_t | npu_id, |
| DLManagedTensorVersioned const * | us, | ||
| DLManagedTensorVersioned const * | vs ) |
Multiplies two 1D Tensors element-wise.
| npu_id | The identifier of the NPU on which to perform the operation. |
| us | The first input tensor. Must be data type bfloat16, same length as vs. |
| vs | The second input tensor. Must be data type bfloat16, same length as us. |
| DLManagedTensorVersioned * mul_npu_f32 | ( | const uint32_t | npu_id, |
| DLManagedTensorVersioned const * | us, | ||
| DLManagedTensorVersioned const * | vs ) |
Multiplies two 1D Tensors of float32 element-wise.
| npu_id | The identifier of the NPU on which to perform the operation. |
| us | The first input tensor. Must be 1D with data type float32, same length as vs. |
| vs | The second input tensor. Must be 1D with data type float32, same length as us. |
| DLManagedTensorVersioned * mul_npu_i16 | ( | const uint32_t | npu_id, |
| DLManagedTensorVersioned const * | us, | ||
| DLManagedTensorVersioned const * | vs ) |
Multiplies two 1D Tensors of int16 element-wise.
| npu_id | The identifier of the NPU on which to perform the operation. |
| us | The first input tensor. Must be data type int16, same length as vs. |
| vs | The second input tensor. Must be data type int16, same length as us. |