Class GPUComputeBackend
Represents a GPUCompute backend ops.
Inherited Members
Namespace: Unity.Sentis
Syntax
public class GPUComputeBackend : CPUBackend, IBackend, IDisposable
Constructors
GPUComputeBackend(ITensorAllocator)
Initializes and returns an instance of GPUComputeOps
.
Declaration
public GPUComputeBackend(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 override DeviceType deviceType { get; }
Property Value
Type | Description |
---|---|
DeviceType |
Overrides
Methods
Abs(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public override 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. |
Overrides
Abs(TensorInt, TensorInt)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public override 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. |
Overrides
Acos(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Acos
trigonometric function: f(x) = acos(x).
Declaration
public override 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. |
Overrides
Acosh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Acosh
trigonometric function: f(x) = acosh(x).
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
And(TensorInt, TensorInt, TensorInt)
Declaration
public override void And(TensorInt A, TensorInt B, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | |
TensorInt | B | |
TensorInt | O |
Overrides
ArgMax(TensorFloat, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public override 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. |
Overrides
ArgMax(TensorInt, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public override 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. |
Overrides
ArgMin(TensorFloat, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public override 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. |
Overrides
ArgMin(TensorInt, TensorInt, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public override 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. |
Overrides
Asin(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Asin
trigonometric function: f(x) = asin(x).
Declaration
public override 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. |
Overrides
Asinh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Asinh
trigonometric function: f(x) = asinh(x).
Declaration
public override 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. |
Overrides
Atan(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Atan
trigonometric function: f(x) = atan(x).
Declaration
public override 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. |
Overrides
Atanh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Atanh
trigonometric function: f(x) = atanh(x).
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
Ceil(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Ceil
math function: f(x) = ceil(x).
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Concat(Tensor[], Tensor, Int32)
Calculates an output tensor by concatenating the input tensors along a given axis.
Declaration
public override 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. |
Overrides
Conv(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Int32, Span<Int32>, Span<Int32>, Span<Int32>, FusableActivation)
Applies a convolution filter to an input tensor.
Declaration
public override 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. |
Overrides
ConvTranspose(TensorFloat, TensorFloat, TensorFloat, TensorFloat, Span<Int32>, Span<Int32>, Span<Int32>, FusableActivation)
Applies a transpose convolution filter to an input tensor.
Declaration
public override 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. |
Overrides
Cos(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Cos
trigonometric function: f(x) = cos(x).
Declaration
public override 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. |
Overrides
Cosh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Cosh
trigonometric function: f(x) = cosh(x).
Declaration
public override 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. |
Overrides
CumSum(TensorFloat, TensorFloat, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public override 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. |
Overrides
CumSum(TensorInt, TensorInt, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
DepthToSpace(TensorFloat, TensorFloat, Int32, DepthToSpaceMode)
Computes the output tensor by permuting data from depth into blocks of spatial data.
Declaration
public override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Einsum(TensorFloat[], TensorFloat, TensorIndex[], TensorIndex, TensorIndex, TensorShape)
Performs an Einsum
math operation.
Declaration
public override 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 |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Erf(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Erf
activation function: f(x) = erf(x).
Declaration
public override 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. |
Overrides
Exp(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Exp
math function: f(x) = exp(x).
Declaration
public override 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. |
Overrides
Expand(Tensor, Tensor)
Calculates an output tensor by broadcasting the input tensor into a given shape.
Declaration
public override 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. |
Overrides
Floor(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Floor
math function: f(x) = floor(x).
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
GatherND(Tensor, TensorInt, Tensor, Int32)
Takes slices of values from the batched input tensor indexed by the indices
tensor.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
GlobalAverageVariancePool(TensorFloat, TensorFloat, Int32)
Declaration
public override void GlobalAverageVariancePool(TensorFloat X, TensorFloat O, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
TensorFloat | O | |
Int32 | axis |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
IsNaN(TensorFloat, TensorInt)
Performs an element-wise IsNaN
logical operation: f(x) = 1 if x is NaN, otherwise f(x) = 0.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Log(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Log
math function: f(x) = log(x).
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
MatMul(TensorFloat, TensorFloat, TensorFloat)
Performs a multi-dimensional matrix multiplication operation: f(a, b) = a x b.
Declaration
public override 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. |
Overrides
MatMul2D(TensorFloat, TensorFloat, TensorFloat, Boolean, Boolean)
Performs a matrix multiplication operation with optional transposes: f(a, b) = a' x b'.
Declaration
public override 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. |
Overrides
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 override void Max(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Overrides
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 override void Max(TensorInt[] tensors, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | |
TensorInt | O | The output tensor to be computed and filled. |
Overrides
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 override 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. |
Overrides
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 override void Mean(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Overrides
MemClear(Tensor)
Sets the entries of a tensor to 0.
Declaration
public override void MemClear(Tensor O)
Parameters
Type | Name | Description |
---|---|---|
Tensor | O | The output tensor to be computed and filled. |
Overrides
MemCopy(Tensor, Tensor)
Creates a copy of a given input tensor with the same shape and values.
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
MemSet(TensorFloat, Single)
Sets the entries of a tensor to a given fill value.
Declaration
public override 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. |
Overrides
MemSet(TensorInt, Int32)
Sets the entries of a tensor to a given fill value.
Declaration
public override 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. |
Overrides
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 override void Min(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Overrides
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 override void Min(TensorInt[] tensors, TensorInt O)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | |
TensorInt | O | The output tensor to be computed and filled. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Neg(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public override 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. |
Overrides
Neg(TensorInt, TensorInt)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public override 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. |
Overrides
NewTensor(TensorShape, DataType, AllocScope)
Allocates a new tensor with the internal allocator.
Declaration
public override Tensor NewTensor(TensorShape shape, DataType dataType, AllocScope scope)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
DataType | dataType | |
AllocScope | scope |
Returns
Type | Description |
---|---|
Tensor |
Overrides
Not(TensorInt, TensorInt)
Performs an element-wise Not
logical operation: f(x) = ~x.
Declaration
public override 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. |
Overrides
OneHot(TensorInt, TensorFloat, Int32, Int32, Single, Single)
Generates a one-hot tensor with a given depth
, indices
and on and off values.
Declaration
public override 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. |
Overrides
OneHot(TensorInt, TensorInt, Int32, Int32, Int32, Int32)
Generates a one-hot tensor with a given depth
, indices
and on and off values.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
PinToDevice(Tensor, Boolean)
Prepares Tensor
for use with CPU backend.
Declaration
public override 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 |
|
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Reciprocal(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Reciprocal
math function: f(x) = 1 / x.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
ReduceSumExp(TensorFloat, TensorFloat, ReadOnlySpan<Int32>, Boolean)
Declaration
public void ReduceSumExp(TensorFloat X, TensorFloat O, ReadOnlySpan<int> axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
TensorFloat | O | |
ReadOnlySpan<Int32> | axes | |
Boolean | keepdim |
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 override 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. |
Overrides
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 override 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. |
Overrides
Relu(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Relu
activation function: f(x) = max(0, x).
Declaration
public override 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. |
Overrides
Relu6(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Relu6
activation function: f(x) = clamp(x, 0, 6).
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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 |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
ScaleBias(TensorFloat, TensorFloat, TensorFloat, TensorFloat)
Computes the output tensor with an element-wise ScaleBias
function: f(x, s, b) = x * s + b.
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
Sigmoid(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sigmoid
activation function: f(x) = 1/(1 + e^(-x)).
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Sin(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sin
trigonometric function: f(x) = sin(x).
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
Sinh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sinh
trigonometric function: f(x) = sinh(x).
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
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 override 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 |
Overrides
Softplus(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Softplus
activation function: f(x) = ln(e^x + 1).
Declaration
public override 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. |
Overrides
Softsign(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Softsign
activation function: f(x) = x/(|x| + 1).
Declaration
public override 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. |
Overrides
SpaceToDepth(TensorFloat, TensorFloat, Int32)
Computes the output tensor by permuting data from blocks of spatial data into depth.
Declaration
public override 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. |
Overrides
Split(Tensor, Tensor, Int32, Int32)
Calculates an output tensor by splitting the input tensor along a given axis between start and end.
Declaration
public override 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. |
Overrides
Sqrt(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Sqrt
math function: f(x) = sqrt(x).
Declaration
public override 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. |
Overrides
Square(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Square
math function: f(x) = x * x.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override void Sum(TensorFloat[] tensors, TensorFloat O)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | |
TensorFloat | O | The output tensor to be computed and filled. |
Overrides
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 override 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. |
Overrides
Tan(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Tan
trigonometric function: f(x) = tan(x).
Declaration
public override 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. |
Overrides
Tanh(TensorFloat, TensorFloat)
Computes an output tensor by applying the element-wise Tanh
activation function: f(x) = tanh(x).
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
Tile(Tensor, Tensor, ReadOnlySpan<Int32>)
Calculates an output tensor by repeating the input layer a given number of times along each axis.
Declaration
public override 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. |
Overrides
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 override 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 |
Overrides
Transpose(Tensor, Tensor)
Calculates an output tensor by reversing the dimensions of the input tensor.
Declaration
public override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
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 override 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. |
Overrides
Xor(TensorInt, TensorInt, TensorInt)
Performs an element-wise Xor
logical operation: f(a) = a ^ b.
Declaration
public override 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. |