Class CPUBackend
Represents a CPU backend ops.
Inherited Members
Namespace: Unity.Sentis
Syntax
public class CPUBackend : IBackend, IDisposable
Constructors
CPUBackend(ITensorAllocator)
Initializes and returns an instance of CPUBackend
.
Declaration
public CPUBackend(ITensorAllocator allocator = null)
Parameters
Type | Name | Description |
---|---|---|
ITensorAllocator | allocator | The allocator to use when allocating tensors. |
Properties
deviceType
Returns the DeviceType
for the ops.
Declaration
public virtual DeviceType deviceType { get; }
Property Value
Type | Description |
---|---|
DeviceType |
Implements
Methods
Abs(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public virtual void Abs(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Abs(TensorInt, TensorInt)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public virtual void Abs(TensorInt X, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Acos(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Acos
trigonometric function: f(x) = acos(x).
Declaration
public virtual void Acos(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Acosh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Acosh
trigonometric function: f(x) = acosh(x).
Declaration
public virtual void Acosh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Add(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Add
math operation: f(a, b) = a + b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Add(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Add(TensorInt, TensorInt, TensorInt)
Performs an element-wise Add
math operation: f(a, b) = a + b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Add(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
And(TensorInt, TensorInt, TensorInt)
Declaration
public virtual void And(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | |
TensorInt | B | |
TensorInt | O |
Implements
ArgMax(TensorFloat, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public virtual void ArgMax(TensorFloat X, TensorInt O, int axis, bool keepdim, bool selectLastIndex)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Boolean | selectLastIndex | Whether to perform the operation from the back of the axis. |
Implements
ArgMax(TensorInt, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public virtual void ArgMax(TensorInt X, TensorInt O, int axis, bool keepdim, bool selectLastIndex)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Boolean | selectLastIndex | Whether to perform the operation from the back of the axis. |
Implements
ArgMin(TensorFloat, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public virtual void ArgMin(TensorFloat X, TensorInt O, int axis, bool keepdim, bool selectLastIndex)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Boolean | selectLastIndex | Whether to perform the operation from the back of the axis. |
Implements
ArgMin(TensorInt, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public virtual void ArgMin(TensorInt X, TensorInt O, int axis, bool keepdim, bool selectLastIndex)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Boolean | selectLastIndex | Whether to perform the operation from the back of the axis. |
Implements
Asin(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Asin
trigonometric function: f(x) = asin(x).
Declaration
public virtual void Asin(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Asinh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Asinh
trigonometric function: f(x) = asinh(x).
Declaration
public virtual void Asinh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Atan(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Atan
trigonometric function: f(x) = atan(x).
Declaration
public virtual void Atan(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Atanh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Atanh
trigonometric function: f(x) = atanh(x).
Declaration
public virtual void Atanh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
AveragePool(TensorFloat, TensorFloat, Int32[], Int32[], Int32[])
Calculates an output tensor by pooling the mean values of the input tensor across its spatial dimensions according to the given pool and stride values.
Declaration
public virtual void AveragePool(TensorFloat X, TensorFloat O, int[] kernelShape, int[] strides, int[] pads)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32[] | kernelShape | The size of the kernel along each spatial axis. |
Int32[] | strides | The stride along each spatial axis. |
Int32[] | pads | The lower and upper padding values for each spatial dimension. For example, [pad_left, pad_right] for 1D, or [pad_top, pad_bottom, pad_left, pad_right] for 2D. |
Implements
BatchNormalization(TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorFloat, Single)
Computes the mean variance on the last dimension of the input tensor and normalizes it according to scale
and bias
tensors.
Declaration
public virtual void BatchNormalization(TensorFloat X, TensorFloat S, TensorFloat B, TensorFloat mean, TensorFloat variance, TensorFloat O, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
TensorFloat | mean | The mean tensor. |
TensorFloat | variance | The variance tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | epsilon | The epsilon value the layer uses to avoid division by zero. |
Implements
Bernoulli(TensorFloat, Tensor, Nullable<Single>)
Generates an output tensor with values 0 or 1 from a Bernoulli distribution. The input tensor contains the probabilities to use for generating the output values.
Declaration
public virtual void Bernoulli(TensorFloat X, Tensor O, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The probabilities input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Nullable<Single> | seed | The optional seed to use for the random number generation. If this is |
Implements
Cast(Tensor, Tensor)
Computes the output tensor using an element-wise Cast
function: f(x) = (float)x or f(x) = (int)x depending on the value of toType
.
Declaration
public virtual void Cast(Tensor X, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
Ceil(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Ceil
math function: f(x) = ceil(x).
Declaration
public virtual void Ceil(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Celu(TensorFloat, TensorFloat, Single)
Computes an output tensor by applying the element-wise Celu
activation function: f(x) = max(0, x) + min(0, alpha * (exp(x / alpha) - 1)).
Declaration
public virtual void Celu(TensorFloat X, TensorFloat O, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Implements
Clip(TensorFloat, TensorFloat, Single, Single)
Computes an output tensor by applying the element-wise Clip
math function: f(x) = clamp(x, min, max).
Declaration
public virtual void Clip(TensorFloat X, TensorFloat O, float min, float max)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | min | The lower clip value. |
Single | max | The upper clip value. |
Implements
CompressWithIndices(Tensor, TensorInt, Tensor, Int32, Int32)
Computes the output tensor by selecting slices from an input tensor according to the 'indices' tensor along an 'axis'.
Declaration
public virtual void CompressWithIndices(Tensor X, TensorInt indices, Tensor O, int numIndices, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | numIndices | The number of indices. |
Int32 | axis | The axis along which to compress. |
Implements
Concat(Tensor[], Tensor, Int32)
Calculates an output tensor by concatenating the input tensors along a given axis.
Declaration
public virtual void Concat(Tensor[] inputs, Tensor O, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | inputs | The input tensors. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to concatenate the input tensors. |
Implements
Conv(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Int32, Span<Int32>, Span<Int32>, Span<Int32>, FusableActivation)
Applies a convolution filter to an input tensor.
Declaration
public virtual void Conv(TensorFloat X, TensorFloat K, TensorFloat B, TensorFloat O, int groups, Span<int> strides, Span<int> pads, Span<int> dilations, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | K | The filter tensor. |
TensorFloat | B | The optional bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | groups | The number of groups that input channels and output channels are divided into. |
Span<Int32> | strides | The optional stride value for each spatial dimension of the filter. |
Span<Int32> | pads | The optional lower and upper padding values for each spatial dimension of the filter. |
Span<Int32> | dilations | The optional dilation value of each spatial dimension of the filter. |
FusableActivation | fusedActivation | The fused activation type to apply after the convolution. |
Implements
ConvTranspose(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Span<Int32>, Span<Int32>, Span<Int32>, FusableActivation)
Applies a transpose convolution filter to an input tensor.
Declaration
public virtual void ConvTranspose(TensorFloat X, TensorFloat W, TensorFloat B, TensorFloat O, Span<int> strides, Span<int> pads, Span<int> outputPadding, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | W | The filter tensor. |
TensorFloat | B | The optional bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Span<Int32> | strides | The optional stride value for each spatial dimension of the filter. |
Span<Int32> | pads | The optional lower and upper padding values for each spatial dimension of the filter. |
Span<Int32> | outputPadding | The output padding value for each spatial dimension in the filter. |
FusableActivation | fusedActivation | The fused activation type to apply after the convolution. |
Implements
Cos(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Cos
trigonometric function: f(x) = cos(x).
Declaration
public virtual void Cos(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Cosh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Cosh
trigonometric function: f(x) = cosh(x).
Declaration
public virtual void Cosh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
CumSum(TensorFloat, TensorFloat, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public virtual void CumSum(TensorFloat X, TensorFloat O, int axis, bool reverse, bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to apply the cumulative sum. |
Boolean | reverse | Whether to perform the cumulative sum from the end of the axis. |
Boolean | exclusive | Whether to include the respective input element in the cumulative sum. |
Implements
CumSum(TensorInt, TensorInt, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public virtual void CumSum(TensorInt X, TensorInt O, int axis, bool reverse, bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to apply the cumulative sum. |
Boolean | reverse | Whether to perform the cumulative sum from the end of the axis. |
Boolean | exclusive | Whether to include the respective input element in the cumulative sum. |
Implements
Dense(TensorFloat, TensorFloat, TensorFloat, TensorFloat, FusableActivation)
Performs a matrix multiplication operation: f(x, w, b) = X x W + B.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Dense(TensorFloat X, TensorFloat W, TensorFloat B, TensorFloat O, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | W | The weights tensor. |
TensorFloat | B | The bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
FusableActivation | fusedActivation | The fused activation to apply to the output tensor after the dense operation. |
Implements
DepthToSpace(TensorFloat, TensorFloat, Int32, DepthToSpaceMode)
Computes the output tensor by permuting data from depth into blocks of spatial data.
Declaration
public virtual void DepthToSpace(TensorFloat X, TensorFloat O, int blocksize, DepthToSpaceMode mode)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | blocksize | The size of the blocks to move the depth data into. |
DepthToSpaceMode | mode | The ordering of the data in the output tensor as a |
Implements
Dispose()
Disposes of the ops and any associated memory.
Declaration
public virtual void Dispose()
Implements
Div(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Div
math operation: f(a, b) = a / b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Div(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Div(TensorInt, TensorInt, TensorInt)
Performs an element-wise Div
math operation: f(a, b) = a / b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Div(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Einsum(TensorFloat[], TensorFloat, TensorIndex[], TensorIndex, TensorIndex, TensorShape)
Performs an Einsum
math operation.
Declaration
public virtual void Einsum(TensorFloat[] inputTensors, TensorFloat O, TensorIndex[] operandIndices, TensorIndex outputIndices, TensorIndex sumIndices, TensorShape sumShape)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | inputTensors | |
TensorFloat | O | |
TensorIndex[] | operandIndices | |
TensorIndex | outputIndices | |
TensorIndex | sumIndices | |
TensorShape | sumShape |
Implements
Elu(TensorFloat, TensorFloat, Single)
Computes an output tensor by applying the element-wise Elu
activation function: f(x) = x if x >= 0, otherwise f(x) = alpha * (e^x - 1).
Declaration
public virtual void Elu(TensorFloat X, TensorFloat O, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Implements
Equal(TensorFloat, TensorFloat, TensorInt)
Performs an element-wise Equal
logical comparison operation: f(a, b) = 1 if a == b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Equal(TensorFloat A, TensorFloat B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Equal(TensorInt, TensorInt, TensorInt)
Performs an element-wise Equal
logical comparison operation: f(a, b) = 1 if a == b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Equal(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Erf(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Erf
activation function: f(x) = erf(x).
Declaration
public virtual void Erf(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Exp(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Exp
math function: f(x) = exp(x).
Declaration
public virtual void Exp(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Expand(Tensor, Tensor)
Calculates an output tensor by broadcasting the input tensor into a given shape.
Declaration
public virtual void Expand(Tensor X, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
Floor(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Floor
math function: f(x) = floor(x).
Declaration
public virtual void Floor(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
FMod(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Mod
math operation: f(a, b) = a % b.
The sign of the remainder is the same as the sign of the dividend, as in C#.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void FMod(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
FMod(TensorInt, TensorInt, TensorInt)
Performs an element-wise Mod
math operation: f(a, b) = a % b.
The sign of the remainder is the same as the sign of the dividend, as in C#.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void FMod(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Gather(Tensor, TensorInt, Tensor, Int32)
Takes values from the input tensor indexed by the indices tensor along a given axis and concatenates them.
Declaration
public virtual void Gather(Tensor X, TensorInt indices, Tensor O, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to gather. |
Implements
GatherElements(Tensor, TensorInt, Tensor, Int32)
Takes values from the input tensor indexed by the indices tensor along a given axis and concatenates them.
Declaration
public virtual void GatherElements(Tensor X, TensorInt indices, Tensor O, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to gather. |
Implements
GatherND(Tensor, TensorInt, Tensor, Int32)
Takes slices of values from the batched input tensor indexed by the indices
tensor.
Declaration
public virtual void GatherND(Tensor X, TensorInt indices, Tensor O, int batchDims)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | batchDims | The number of batch dimensions of the input tensor, the gather begins at the next dimension. |
Implements
Gelu(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Gelu
activation function: f(x) = x / 2 * (1 + erf(x / sqrt(2))).
Declaration
public virtual void Gelu(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
GlobalAveragePool(TensorFloat, TensorFloat)
Calculates an output tensor by pooling the mean values of the input tensor across all of its spatial dimensions. The spatial dimensions of the output are size 1.
Declaration
public virtual void GlobalAveragePool(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
GlobalAverageVariancePool(TensorFloat, TensorFloat, Int32)
Declaration
public virtual void GlobalAverageVariancePool(TensorFloat X, TensorFloat O, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
TensorFloat | O | |
Int32 | axis |
GlobalMaxPool(TensorFloat, TensorFloat)
Calculates an output tensor by pooling the maximum values of the input tensor across all of its spatial dimensions. The spatial dimensions of the output are size 1.
Declaration
public virtual void GlobalMaxPool(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Greater(TensorFloat, TensorFloat, TensorInt)
Performs an element-wise Greater
logical comparison operation: f(a, b) = 1 if a > b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Greater(TensorFloat A, TensorFloat B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Greater(TensorInt, TensorInt, TensorInt)
Performs an element-wise Greater
logical comparison operation: f(a, b) = 1 if a > b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Greater(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
GreaterOrEqual(TensorFloat, TensorFloat, TensorInt)
Performs an element-wise GreaterOrEqual
logical comparison operation: f(a, b) = 1 if a >= b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void GreaterOrEqual(TensorFloat A, TensorFloat B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
GreaterOrEqual(TensorInt, TensorInt, TensorInt)
Performs an element-wise GreaterOrEqual
logical comparison operation: f(a, b) = 1 if a >= b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void GreaterOrEqual(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Hardmax(TensorFloat, TensorFloat, Int32)
Computes an output tensor by applying the Hardmax
activation function along an axis: f(x, axis) = 1 if x is the first maximum value along the specified axis, otherwise f(x) = 0.
Declaration
public virtual void Hardmax(TensorFloat X, TensorFloat O, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to apply the |
Implements
HardSigmoid(TensorFloat, TensorFloat, Single, Single)
Computes an output tensor by applying the element-wise HardSigmoid
activation function: f(x) = clamp(alpha * x + beta, 0, 1).
Declaration
public virtual void HardSigmoid(TensorFloat X, TensorFloat O, float alpha, float beta)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Single | beta | The beta value to use for the |
Implements
HardSwish(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise HardSwish
activation function: f(x) = x * max(0, min(1, 1/6 * x + 0.5)).
Declaration
public virtual void HardSwish(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
InstanceNormalization(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Single)
Computes the mean variance on the spatial dimensions of the input tensor and normalizes them according to scale
and bias
tensors.
Declaration
public virtual void InstanceNormalization(TensorFloat X, TensorFloat S, TensorFloat B, TensorFloat O, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | epsilon | The epsilon value the layer uses to avoid division by zero. |
Implements
IsInf(TensorFloat, TensorInt, Boolean, Boolean)
Performs an element-wise IsInf
logical operation: f(x) = 1 elementwise if x is +Inf and detectPositive
is true
, or x is -Inf and detectNegative
is true
. Otherwise f(x) = 0.
Declaration
public virtual void IsInf(TensorFloat X, TensorInt O, bool detectNegative, bool detectPositive)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Boolean | detectNegative | Whether to detect negative infinities in the |
Boolean | detectPositive | Whether to detect positive infinities in the |
Implements
IsNaN(TensorFloat, TensorInt)
Performs an element-wise IsNaN
logical operation: f(x) = 1 if x is NaN, otherwise f(x) = 0.
Declaration
public virtual void IsNaN(TensorFloat X, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
LayerNormalization(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Single)
Computes the mean variance on the last dimension of the input tensor and normalizes it according to scale
and bias
tensors.
Declaration
public virtual void LayerNormalization(TensorFloat X, TensorFloat S, TensorFloat B, TensorFloat O, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | epsilon | The epsilon value the layer uses to avoid division by zero. |
Implements
LeakyRelu(TensorFloat, TensorFloat, Single)
Computes an output tensor by applying the element-wise LeakyRelu
activation function: f(x) = x if x >= 0, otherwise f(x) = alpha * x.
Declaration
public virtual void LeakyRelu(TensorFloat X, TensorFloat O, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Implements
Less(TensorFloat, TensorFloat, TensorInt)
Performs an element-wise Less
logical comparison operation: f(a, b) = 1 if a < b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Less(TensorFloat A, TensorFloat B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Less(TensorInt, TensorInt, TensorInt)
Performs an element-wise Less
logical comparison operation: f(a, b) = 1 if a < b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Less(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
LessOrEqual(TensorFloat, TensorFloat, TensorInt)
Performs an element-wise LessOrEqual
logical comparison operation: f(a, b) = 1 if a <= b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void LessOrEqual(TensorFloat A, TensorFloat B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
LessOrEqual(TensorInt, TensorInt, TensorInt)
Performs an element-wise LessOrEqual
logical comparison operation: f(a, b) = 1 if a <= b, otherwise f(x) = 0.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void LessOrEqual(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Log(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Log
math function: f(x) = log(x).
Declaration
public virtual void Log(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
LogSoftmax(TensorFloat, TensorFloat, Int32)
Computes an output tensor by applying the LogSoftmax
activation function along an axis: f(x, axis) = log(Softmax(x, axis)).
Declaration
public virtual void LogSoftmax(TensorFloat X, TensorFloat O, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to apply the |
Implements
LRN(TensorFloat, TensorFloat, Single, Single, Single, Int32)
Normalizes the input tensor over local input regions.
Declaration
public virtual void LRN(TensorFloat X, TensorFloat O, float alpha, float beta, float bias, int size)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The scaling parameter to use for the normalization. |
Single | beta | The exponent to use for the normalization. |
Single | bias | The bias value to use for the normalization. |
Int32 | size | The number of channels to sum over. |
Implements
LSTM(TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorInt, TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorFloat, RnnDirection, RnnActivation[], Single[], Single[], Boolean, Single, RnnLayout)
Generates an output tensor by computing a one-layer long short-term memory (LSTM) on an input tensor.
Declaration
public virtual void LSTM(TensorFloat X, TensorFloat W, TensorFloat R, TensorFloat B, TensorInt sequenceLens, TensorFloat initialH, TensorFloat initialC, TensorFloat P, TensorFloat Y, TensorFloat Yh, TensorFloat Yc, RnnDirection direction, RnnActivation[] activations, float[] activationAlpha, float[] activationBeta, bool inputForget, float clip, RnnLayout layout)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input sequences tensor. |
TensorFloat | W | The weights tensor for the gates of the LSTM. |
TensorFloat | R | The recurrent weights tensor for the gates of the LSTM. |
TensorFloat | B | The optional bias tensor for the input gate of the LSTM. |
TensorInt | sequenceLens | The optional 1D tensor specifying the lengths of the sequences in a batch. |
TensorFloat | initialH | The optional initial values tensor of the hidden neurons of the LSTM. If this is |
TensorFloat | initialC | The optional initial values tensor of the cells of the LSTM. If this is |
TensorFloat | P | The optional weight tensor for the peepholes of the LSTM. If this is |
TensorFloat | Y | The output tensor to be computed and filled with the concatenated intermediate output values of the hidden. |
TensorFloat | Yh | The output tensor to be computed and filled with the last output value of the hidden. |
TensorFloat | Yc | The output tensor to be computed and filled with the last output value of the cell. |
RnnDirection | direction | The direction of the LSTM as an |
RnnActivation[] | activations | The activation functions of the LSTM as an array of |
Single[] | activationAlpha | The alpha values of the activation functions of the LSTM. |
Single[] | activationBeta | The beta values of the activation functions of the LSTM. |
Boolean | inputForget | Whether to forget the input values in the LSTM. If this is |
Single | clip | The cell clip threshold of the LSTM. |
RnnLayout | layout | The layout of the tensors as an |
Implements
MatMul(TensorFloat, TensorFloat, TensorFloat)
Performs a multi-dimensional matrix multiplication operation: f(a, b) = a x b.
Declaration
public virtual void MatMul(TensorFloat X, TensorFloat Y, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The first input tensor. |
TensorFloat | Y | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
MatMul2D(TensorFloat, TensorFloat, TensorFloat, Boolean, Boolean)
Performs a matrix multiplication operation with optional transposes: f(a, b) = a' x b'.
Declaration
public virtual void MatMul2D(TensorFloat X, TensorFloat Y, TensorFloat O, bool xTranspose, bool yTranspose)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The first input tensor. |
TensorFloat | Y | The second input tensor. |
TensorFloat | O | The output tensor. |
Boolean | xTranspose | Whether to transpose the first input tensor before performing the matrix multiplication. |
Boolean | yTranspose | Whether to transpose the second input tensor before performing the matrix multiplication. |
Implements
Max(TensorFloat[], TensorFloat)
Performs an element-wise Max
math operation: f(x1, x2 ... xn) = max(x1, x2 ... xn).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Max(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Max(TensorInt[], TensorInt)
Performs an element-wise Max
math operation: f(x1, x2 ... xn) = max(x1, x2 ... xn).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Max(TensorInt[] tensors, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | |
TensorInt | O | The output tensor to be computed and filled. |
Implements
MaxPool(TensorFloat, TensorFloat, Int32[], Int32[], Int32[])
Calculates an output tensor by pooling the maximum values of the input tensor across its spatial dimensions according to the given pool and stride values.
Declaration
public virtual void MaxPool(TensorFloat X, TensorFloat O, int[] kernelShape, int[] strides, int[] pads)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32[] | kernelShape | The size of the kernel along each spatial axis. |
Int32[] | strides | The stride along each spatial axis. |
Int32[] | pads | The lower and upper padding values for each spatial dimension. For example, [pad_left, pad_right] for 1D, or [pad_top, pad_bottom, pad_left, pad_right] for 2D. |
Implements
Mean(TensorFloat[], TensorFloat)
Performs an element-wise Mean
math operation: f(x1, x2 ... xn) = (x1 + x2 ... xn) / n.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Mean(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
MemClear(Tensor)
Sets the entries of a tensor to 0.
Declaration
public virtual void MemClear(Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | O | The output tensor to be computed and filled. |
Implements
MemCopy(Tensor, Tensor)
Creates a copy of a given input tensor with the same shape and values.
Declaration
public virtual void MemCopy(Tensor X, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
MemCopyStride(Tensor, Tensor, Int32, Int32, Int32, Int32, Int32, Int32)
Copy blocks of values from X to O, we copy 'count' blocks each of length 'length' values with initial offsets given by 'offsetX', 'offsetO' and with strides given by 'strideX', 'strideO'
Declaration
public virtual void MemCopyStride(Tensor X, Tensor O, int strideX, int strideO, int length, int count, int offsetX, int offsetO)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | O | |
Int32 | strideX | |
Int32 | strideO | |
Int32 | length | |
Int32 | count | |
Int32 | offsetX | |
Int32 | offsetO |
Implements
MemSet(Tensor, Int32)
Set values of O to value
Declaration
protected virtual void MemSet(Tensor O, int value)
Parameters
Type | Name | Description |
---|---|---|
Tensor | O | |
Int32 | value |
MemSet(TensorFloat, Single)
Sets the entries of a tensor to a given fill value.
Declaration
public virtual void MemSet(TensorFloat O, float value)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | O | The output tensor to be computed and filled. |
Single | value | The fill value. |
Implements
MemSet(TensorInt, Int32)
Sets the entries of a tensor to a given fill value.
Declaration
public virtual void MemSet(TensorInt O, int value)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | O | The output tensor to be computed and filled. |
Int32 | value | The fill value. |
Implements
Min(TensorFloat[], TensorFloat)
Performs an element-wise Min
math operation: f(x1, x2 ... xn) = min(x1, x2 ... xn).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Min(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Min(TensorInt[], TensorInt)
Performs an element-wise Min
math operation: f(x1, x2 ... xn) = min(x1, x2 ... xn).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Min(TensorInt[] tensors, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Mod(TensorInt, TensorInt, TensorInt)
Performs an element-wise Mod
math operation: f(a, b) = a % b.
The sign of the remainder is the same as the sign of the divisor, as in Python.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Mod(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Mul(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Mul
math operation: f(a, b) = a * b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Mul(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Mul(TensorInt, TensorInt, TensorInt)
Performs an element-wise Mul
math operation: f(a, b) = a * b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Mul(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Neg(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public virtual void Neg(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Neg(TensorInt, TensorInt)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public virtual void Neg(TensorInt X, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
NewOutputTensor(TensorShape, DataType)
Allocate a new Tensor
of a given shape and data type using the AllocScope.LayerOutput
scope.
Declaration
public Tensor NewOutputTensor(TensorShape shape, DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
DataType | dataType |
Returns
Type | Description |
---|---|
Tensor |
Implements
NewOutputTensorFloat(TensorShape)
Allocate a new TensorFloat
of a given shape using the AllocScope.LayerOutput
scope.
Declaration
public TensorFloat NewOutputTensorFloat(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorFloat |
Implements
NewOutputTensorInt(TensorShape)
Allocate a new TensorInt
of a given shape using the AllocScope.LayerOutput
scope.
Declaration
public TensorInt NewOutputTensorInt(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorInt |
Implements
NewTempTensor(TensorShape, DataType)
Allocate a new Tensor
of a given shape and data type using the AllocScope.InternalToLayer
scope.
Declaration
public Tensor NewTempTensor(TensorShape shape, DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
DataType | dataType |
Returns
Type | Description |
---|---|
Tensor |
NewTempTensorFloat(TensorShape)
Allocate a new TensorFloat
of a given shape using the AllocScope.InternalToLayer
scope.
Declaration
public TensorFloat NewTempTensorFloat(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorFloat |
Implements
NewTempTensorInt(TensorShape)
Allocate a new TensorInt
of a given shape using the AllocScope.InternalToLayer
scope.
Declaration
public TensorInt NewTempTensorInt(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorInt |
Implements
NewTensor(TensorShape, DataType, AllocScope)
Allocates a new tensor with the internal allocator.
Declaration
public virtual Tensor NewTensor(TensorShape shape, DataType dataType, AllocScope scope)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
DataType | dataType | |
AllocScope | scope |
Returns
Type | Description |
---|---|
Tensor |
Implements
Not(TensorInt, TensorInt)
Performs an element-wise Not
logical operation: f(x) = ~x.
Declaration
public virtual void Not(TensorInt X, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
OneHot(TensorInt, TensorFloat, Int32, Int32, Single, Single)
Generates a one-hot tensor with a given depth
, indices
and on and off values.
Declaration
public virtual void OneHot(TensorInt X, TensorFloat O, int axis, int depth, float offValue, float onValue)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which the operation adds the one-hot representation. |
Int32 | depth | The depth of the one-hot tensor. |
Single | offValue | The value to use for an off element. |
Single | onValue | The value to use for an on element. |
Implements
OneHot(TensorInt, TensorInt, Int32, Int32, Int32, Int32)
Generates a one-hot tensor with a given depth
, indices
and on and off values.
Declaration
public virtual void OneHot(TensorInt X, TensorInt O, int axis, int depth, int offValue, int onValue)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | |
TensorInt | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which the operation adds the one-hot representation. |
Int32 | depth | The depth of the one-hot tensor. |
Int32 | offValue | The value to use for an off element. |
Int32 | onValue | The value to use for an on element. |
Implements
Or(TensorInt, TensorInt, TensorInt)
Performs an element-wise Or
logical operation: f(a, b) = a | b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Or(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Pad(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, PadMode, Single)
Calculates the output tensor by adding padding to the input tensor according to the given padding values and mode.
Declaration
public virtual void Pad(TensorFloat X, TensorFloat O, ReadOnlySpan<int> pad, PadMode padMode, float constant)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | pad | The lower and upper padding values for each dimension. |
PadMode | padMode | The |
Single | constant | The constant value to fill with when using |
Implements
PinToDevice(Tensor, Boolean)
Prepares Tensor
for use with CPU backend.
Declaration
public virtual Tensor PinToDevice(Tensor X, bool clearOnInit = true)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
|
Boolean | clearOnInit | Whether to copy tensor data to CPU backend. |
Returns
Type | Description |
---|---|
Tensor |
|
Implements
Pow(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Pow
math operation: f(a, b) = pow(a, b).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Pow(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Pow(TensorFloat, TensorInt, TensorFloat)
Performs an element-wise Pow
math operation: f(a, b) = pow(a, b).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Pow(TensorFloat A, TensorInt B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
PRelu(TensorFloat, TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise PRelu
activation function: f(x) = x if x >= 0, otherwise f(x) = slope * x.
Declaration
public virtual void PRelu(TensorFloat X, TensorFloat S, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
RandomNormal(TensorFloat, Single, Single, Nullable<Single>)
Generates an output tensor of a given shape with random values in a normal distribution with given mean
and scale
, and an optional seed
value.
Declaration
public virtual void RandomNormal(TensorFloat O, float mean, float scale, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | O | The output tensor to be computed and filled. |
Single | mean | The mean of the normal distribution to use to generate the output. |
Single | scale | The standard deviation of the normal distribution to use to generate the output. |
Nullable<Single> | seed | The optional seed to use for the random number generation. If this is |
Implements
RandomUniform(TensorFloat, Single, Single, Nullable<Single>)
Generates an output tensor of a given shape with random values in a uniform distribution between a given low
and high
, and an optional seed
value.
Declaration
public virtual void RandomUniform(TensorFloat O, float low, float high, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | O | The output tensor to be computed and filled. |
Single | low | The lower end of the interval of the uniform distribution to use to generate the output. |
Single | high | The upper end of the interval of the uniform distribution to use to generate the output. |
Nullable<Single> | seed | The optional seed to use for the random number generation. If this is |
Implements
Range(TensorFloat, Single, Single)
Generates a 1D output tensor where the values form an arithmetic progression defined by the start
and delta
values.
Declaration
public virtual void Range(TensorFloat O, float start, float delta)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | O | The output tensor to be computed and filled. |
Single | start | The first value in the range. |
Single | delta | The delta between subsequent values in the range. |
Implements
Range(TensorInt, Int32, Int32)
Generates a 1D output tensor where the values form an arithmetic progression defined by the start
and delta
values.
Declaration
public virtual void Range(TensorInt O, int start, int delta)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | O | The output tensor to be computed and filled. |
Int32 | start | The first value in the range. |
Int32 | delta | The delta between subsequent values in the range. |
Implements
Reciprocal(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Reciprocal
math function: f(x) = 1 / x.
Declaration
public virtual void Reciprocal(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
ReduceL1(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceL1
operation: f(x1, x2 ... xn) = |x1| + |x2| + ... + |xn|.
Declaration
public virtual void ReduceL1(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceL1(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceL1
operation: f(x1, x2 ... xn) = |x1| + |x2| + ... + |xn|.
Declaration
public virtual void ReduceL1(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceL2(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceL2
operation: f(x1, x2 ... xn) = sqrt(x1² + x2² + ... + xn²).
Declaration
public virtual void ReduceL2(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceLogSum(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceLogSum
operation: f(x1, x2 ... xn) = log(x1 + x2 + ... + xn).
Declaration
public virtual void ReduceLogSum(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceLogSumExp(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceLogSumExp
operation: f(x1, x2 ... xn) = log(e^x1 + e^x2 + ... + e^xn).
Declaration
public virtual void ReduceLogSumExp(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceMax(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceMax
operation: f(x1, x2 ... xn) = max(x1, x2, ... , xn).
Declaration
public virtual void ReduceMax(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceMax(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceMean
operation: f(x1, x2 ... xn) = max(x1, x2, ... , xn).
Declaration
public virtual void ReduceMax(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceMean(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceMean
operation: f(x1, x2 ... xn) = (x1 + x2 + ... + xn) / n.
Declaration
public virtual void ReduceMean(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceMin(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceMin
operation: f(x1, x2 ... xn) = min(x1, x2, ... , xn).
Declaration
public virtual void ReduceMin(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceMin(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceMin
operation: f(x1, x2 ... xn) = min(x1, x2, ... , xn).
Declaration
public virtual void ReduceMin(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceProd(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceProd
operation: f(x1, x2 ... xn) = x1 * x2 * ... * xn.
Declaration
public virtual void ReduceProd(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceProd(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceProd
operation: f(x1, x2 ... xn) = x1 * x2 * ... * xn.
Declaration
public virtual void ReduceProd(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceSum(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceSum
operation: f(x1, x2 ... xn) = x1 + x2 + ... + xn.
Declaration
public virtual void ReduceSum(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceSum(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceSum
operation: f(x1, x2 ... xn) = x1 + x2 + ... + xn.
Declaration
public virtual void ReduceSum(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceSumSquare(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceSumSquare
operation: f(x1, x2 ... xn) = x1² + x2² + ... + xn².
Declaration
public virtual void ReduceSumSquare(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
ReduceSumSquare(TensorInt, TensorInt, ReadOnlySpan<Int32>, Boolean)
Reduces an input tensor along the given axes using the ReduceSumSquare
operation: f(x1, x2 ... xn) = x1² + x2² + ... + xn².
Declaration
public virtual void ReduceSumSquare(TensorInt X, TensorInt O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Implements
Relu(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Relu
activation function: f(x) = max(0, x).
Declaration
public virtual void Relu(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Relu6(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Relu6
activation function: f(x) = clamp(x, 0, 6).
Declaration
public virtual void Relu6(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
ResetAllocator(Boolean)
Resets the internal allocator.
Declaration
public virtual void ResetAllocator(bool keepCachedMemory = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | keepCachedMemory |
Implements
Reshape(Tensor, Tensor)
Calculates an output tensor by copying the data from the input tensor and using a given shape. The data from the input tensor is unchanged.
Declaration
public virtual void Reshape(Tensor X, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
Resize(TensorFloat, TensorFloat, ReadOnlySpan<Single>, InterpolationMode, NearestMode, CoordTransformMode)
Calculates an output tensor by resampling the input tensor along the spatial dimensions with given scales.
Declaration
public virtual void Resize(TensorFloat X, TensorFloat O, ReadOnlySpan<float> scale, InterpolationMode interpolationMode, NearestMode nearestMode, CoordTransformMode coordTransformMode)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ReadOnlySpan<Single> | scale | The factor to scale each dimension by. |
InterpolationMode | interpolationMode | The |
NearestMode | nearestMode | The |
CoordTransformMode | coordTransformMode | The |
Implements
RoiAlign(TensorFloat, TensorFloat, TensorInt, TensorFloat, RoiPoolingMode, Int32, Int32, Int32, Single)
Calculates an output tensor by pooling the input tensor across each region of interest given by the rois
tensor.
Declaration
public virtual void RoiAlign(TensorFloat X, TensorFloat rois, TensorInt indices, TensorFloat O, RoiPoolingMode mode, int outputHeight, int outputWidth, int samplingRatio, float spatialScale)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | rois | The region of interest input tensor. |
TensorInt | indices | The indices input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
RoiPoolingMode | mode | The pooling mode of the operation as an |
Int32 | outputHeight | The height of the output tensor. |
Int32 | outputWidth | The width of the output tensor. |
Int32 | samplingRatio | The number of sampling points in the interpolation grid used to compute the output value of each pooled output bin. |
Single | spatialScale | The multiplicative spatial scale factor used to translate coordinates from their input spatial scale to the scale used when pooling. |
Implements
Round(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Round
math function: f(x) = round(x).
If the fractional part is equal to 0.5, rounds to the nearest even integer.
Declaration
public virtual void Round(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
ScalarMad(TensorFloat, TensorFloat, Single, Single)
Performs an element-wise Mad
math operation: multiplies and adds bias to a tensor: f(T, s, b) = s * T + b.
Declaration
public virtual void ScalarMad(TensorFloat X, TensorFloat O, float s, float b)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | s | Input scalar for multiplication. |
Single | b | Input bias for addition. |
Implements
ScaleBias(TensorFloat, TensorFloat, TensorFloat, TensorFloat)
Computes the output tensor with an element-wise ScaleBias
function: f(x, s, b) = x * s + b.
Declaration
public virtual void ScaleBias(TensorFloat X, TensorFloat S, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
ScatterElements(Tensor, TensorInt, Tensor, Tensor, Int32, ScatterReductionMode)
Copies the input tensor and updates values at indexes specified by the indices
tensor with values specified by the updates
tensor along a given axis.
ScatterElements
updates the values depending on the reduction mode used.
Declaration
public virtual void ScatterElements(Tensor X, TensorInt indices, Tensor updates, Tensor O, int axis, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | updates | The updates tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | axis | The axis on which to perform the scatter. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Implements
ScatterND(TensorFloat, TensorInt, TensorFloat, TensorFloat, ScatterReductionMode)
Copies the input tensor and updates values at indexes specified by the indices
tensor with values specified by the updates
tensor.
ScatterND
updates the values depending on the reduction mode used.
Declaration
public virtual void ScatterND(TensorFloat X, TensorInt indices, TensorFloat updates, TensorFloat O, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | indices | The indices tensor. |
TensorFloat | updates | The updates tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Implements
ScatterND(TensorInt, TensorInt, TensorInt, TensorInt, ScatterReductionMode)
Copies the input tensor and updates values at indexes specified by the indices
tensor with values specified by the updates
tensor.
ScatterND
updates the values depending on the reduction mode used.
Declaration
public virtual void ScatterND(TensorInt X, TensorInt indices, TensorInt updates, TensorInt O, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | indices | The indices tensor. |
TensorInt | updates | The updates tensor. |
TensorInt | O | The output tensor to be computed and filled. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Implements
Selu(TensorFloat, TensorFloat, Single, Single)
Computes an output tensor by applying the element-wise Selu
activation function: f(x) = gamma * x if x >= 0, otherwise f(x) = (alpha * e^x - alpha).
Declaration
public virtual void Selu(TensorFloat X, TensorFloat O, float alpha, float gamma)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Single | gamma | The alpha value to use for the |
Implements
ShallowCopy(Tensor, AllocScope)
Declaration
public virtual Tensor ShallowCopy(Tensor X, AllocScope allocScope)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
AllocScope | allocScope |
Returns
Type | Description |
---|---|
Tensor |
Implements
ShallowReshape(Tensor, TensorShape, AllocScope)
Declaration
public virtual Tensor ShallowReshape(Tensor X, TensorShape shape, AllocScope allocScope)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
TensorShape | shape | |
AllocScope | allocScope |
Returns
Type | Description |
---|---|
Tensor |
Implements
Shrink(TensorFloat, TensorFloat, Single, Single)
Computes an output tensor by applying the element-wise Shrink
activation function: f(x) = x + bias if x < lambd. f(x) = x - bias if x > lambd. Otherwise f(x) = 0.
Declaration
public virtual void Shrink(TensorFloat X, TensorFloat O, float bias, float lambd)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | bias | The bias value to use for the |
Single | lambd | The lambda value to use for the |
Implements
Sigmoid(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sigmoid
activation function: f(x) = 1/(1 + e^(-x)).
Declaration
public virtual void Sigmoid(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Sign(TensorFloat, TensorFloat)
Performs an element-wise Sign
math operation: f(x) = 1 if x > 0. f(x) = -1 if x < 0. Otherwise f(x) = 0.
Declaration
public virtual void Sign(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Sign(TensorInt, TensorInt)
Performs an element-wise Sign
math operation: f(x) = 1 if x > 0. f(x) = -1 if x < 0. Otherwise f(x) = 0.
Declaration
public virtual void Sign(TensorInt X, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Sin(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sin
trigonometric function: f(x) = sin(x).
Declaration
public virtual void Sin(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
SinglePassLSTM(TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorInt, TensorFloat, TensorFloat, TensorFloat, TensorFloat, RnnActivation[], Single[], Single[], Boolean, Single, Boolean, Int32, RnnLayout)
Computes a single pass LSTM either forward or reverse dirIndex and layout are used to calculate where to index the various tensors in bidirectional and batch first layout passes X has given layout W, R are cropped to single direction P, B are full number of directions Y has given layout and full number of directions (matches output of Layer) Y_h, Y_c are SequenceFirst layout and cropped to single direction HtxRT and XsixWT are temp vectors of the correct dimension for the intermediate results of the matmuls activations, activationAlpha and activationBeta have full number of dimensions
Declaration
protected virtual void SinglePassLSTM(TensorFloat X, TensorFloat W, TensorFloat R, TensorFloat B, TensorInt sequenceLens, TensorFloat P, TensorFloat Y, TensorFloat Y_h, TensorFloat Y_c, RnnActivation[] activations, float[] activationAlpha, float[] activationBeta, bool inputForget, float clip, bool isReverse, int dirIndex, RnnLayout layout)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
TensorFloat | W | |
TensorFloat | R | |
TensorFloat | B | |
TensorInt | sequenceLens | |
TensorFloat | P | |
TensorFloat | Y | |
TensorFloat | Y_h | |
TensorFloat | Y_c | |
RnnActivation[] | activations | |
Single[] | activationAlpha | |
Single[] | activationBeta | |
Boolean | inputForget | |
Single | clip | |
Boolean | isReverse | |
Int32 | dirIndex | |
RnnLayout | layout |
Sinh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sinh
trigonometric function: f(x) = sinh(x).
Declaration
public virtual void Sinh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Slice(Tensor, Tensor, ReadOnlySpan<Int32>, ReadOnlySpan<Int32>, ReadOnlySpan<Int32>)
Calculates an output tensor by slicing the input tensor along given axes with given starts, ends, and steps.
Declaration
public virtual void Slice(Tensor X, Tensor O, ReadOnlySpan<int> starts, ReadOnlySpan<int> axes, ReadOnlySpan<int> steps)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | starts | The start index along each axis. |
ReadOnlySpan<Int32> | axes | The axes along which to slice. If this is |
ReadOnlySpan<Int32> | steps | The step values for slicing. If this is |
Implements
Softmax(TensorFloat, TensorFloat, Int32)
Computes an output tensor by applying the Softmax
activation function along an axis: f(x, axis) = exp(X) / ReduceSum(exp(X), axis).
Declaration
public virtual void Softmax(TensorFloat X, TensorFloat O, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to apply the |
Implements
Softplus(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Softplus
activation function: f(x) = ln(e^x + 1).
Declaration
public virtual void Softplus(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Softsign(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Softsign
activation function: f(x) = x/(|x| + 1).
Declaration
public virtual void Softsign(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
SpaceToDepth(TensorFloat, TensorFloat, Int32)
Computes the output tensor by permuting data from blocks of spatial data into depth.
Declaration
public virtual void SpaceToDepth(TensorFloat X, TensorFloat O, int blocksize)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Int32 | blocksize | The size of the blocks to move the depth data into. |
Implements
Split(Tensor, Tensor, Int32, Int32)
Calculates an output tensor by splitting the input tensor along a given axis between start and end.
Declaration
public virtual void Split(Tensor X, Tensor O, int axis, int start)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | axis | The axis along which to split the input tensor. |
Int32 | start | The inclusive start value for the split. |
Implements
Sqrt(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sqrt
math function: f(x) = sqrt(x).
Declaration
public virtual void Sqrt(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Square(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Square
math function: f(x) = x * x.
Declaration
public virtual void Square(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Sub(TensorFloat, TensorFloat, TensorFloat)
Performs an element-wise Sub
math operation: f(a, b) = a - b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Sub(TensorFloat A, TensorFloat B, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Sub(TensorInt, TensorInt, TensorInt)
Performs an element-wise Sub
math operation: f(a, b) = a - b.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Sub(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |
Implements
Sum(TensorFloat[], TensorFloat)
Performs an element-wise Sum
math operation: f(x1, x2 ... xn) = x1 + x2 ... xn.
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual void Sum(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Swish(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Swish
activation function: f(x) = sigmoid(x) * x = x / (1 + e^{-x}).
Declaration
public virtual void Swish(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Tan(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Tan
trigonometric function: f(x) = tan(x).
Declaration
public virtual void Tan(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
Tanh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Tanh
activation function: f(x) = tanh(x).
Declaration
public virtual void Tanh(TensorFloat X, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Implements
ThresholdedRelu(TensorFloat, TensorFloat, Single)
Computes an output tensor by applying the element-wise ThresholdedRelu
activation function: f(x) = x if x > alpha, otherwise f(x) = 0.
Declaration
public virtual void ThresholdedRelu(TensorFloat X, TensorFloat O, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | O | The output tensor to be computed and filled. |
Single | alpha | The alpha value to use for the |
Implements
Tile(Tensor, Tensor, ReadOnlySpan<Int32>)
Calculates an output tensor by repeating the input layer a given number of times along each axis.
Declaration
public virtual void Tile(Tensor X, Tensor O, ReadOnlySpan<int> repeats)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
ReadOnlySpan<Int32> | repeats | The number of times to tile the input tensor along each axis. |
Implements
TopK(TensorFloat, TensorFloat, TensorInt, Int32, Int32, Boolean)
Calculates the top-K largest or smallest elements of an input tensor along a given axis.
Declaration
public virtual void TopK(TensorFloat X, TensorFloat values, TensorInt indices, int k, int axis, bool largest)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | values | The output tensor to be computed and filled with the top K values from the input tensor. |
TensorInt | indices | The output tensor to be computed and filled with the corresponding input tensor indices for the top K values from the input tensor. |
Int32 | k | The number of elements to calculate. |
Int32 | axis | The axis along which to perform the top-K operation. |
Boolean | largest | Whether to calculate the top-K largest elements. If this is |
Implements
Transpose(Tensor, Tensor)
Calculates an output tensor by reversing the dimensions of the input tensor.
Declaration
public virtual void Transpose(Tensor X, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
Transpose(Tensor, Tensor, Int32[])
Calculates an output tensor by permuting the axes and data of the input tensor according to the given permutations.
Declaration
public virtual void Transpose(Tensor X, Tensor O, int[] permutations)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32[] | permutations | The axes to sample the output tensor from in the input tensor. |
Implements
Tril(Tensor, Tensor, Int32)
Computes the output tensor by retaining the lower triangular values from an input matrix or matrix batch and setting the other values to zero.
Declaration
public virtual void Tril(Tensor X, Tensor O, int k)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | k | The offset from the diagonal to keep. |
Implements
Triu(Tensor, Tensor, Int32)
Computes the output tensor by retaining the upper triangular values from an input matrix or matrix batch and setting the other values to zero.
Declaration
public virtual void Triu(Tensor X, Tensor O, int k)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Int32 | k | The offset from the diagonal to exclude. |
Implements
Where(TensorInt, Tensor, Tensor, Tensor)
Performs an element-wise Where
logical operation: f(condition, a, b) = a if condition
is true
, otherwise f(condition, a, b) = b.
Declaration
public virtual void Where(TensorInt C, Tensor A, Tensor B, Tensor O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | C | The condition tensor. |
Tensor | A | The first input tensor. |
Tensor | B | The second input tensor. |
Tensor | O | The output tensor to be computed and filled. |
Implements
Xor(TensorInt, TensorInt, TensorInt)
Performs an element-wise Xor
logical operation: f(a) = a ^ b.
Declaration
public virtual void Xor(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
TensorInt | O | The output tensor to be computed and filled. |