Class CPUOps
Represents a CPU backend ops.
Inherited Members
Namespace: Unity.Sentis
Syntax
public class CPUOps : IOps, IDisposable
Constructors
CPUOps(ITensorAllocator)
Initializes and returns an instance of CPUOps
.
Declaration
public CPUOps(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)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public virtual TensorFloat Abs(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Abs(TensorInt)
Computes an output tensor by applying the element-wise Abs
math function: f(x) = f(x) = |x|.
Declaration
public virtual TensorInt Abs(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Acos(TensorFloat)
Computes an output tensor by applying the element-wise Acos
trigonometric function: f(x) = acos(x).
Declaration
public virtual TensorFloat Acos(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Acosh(TensorFloat)
Computes an output tensor by applying the element-wise Acosh
trigonometric function: f(x) = acosh(x).
Declaration
public virtual TensorFloat Acosh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Add(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 TensorFloat Add(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Add(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 TensorInt Add(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
And(TensorInt, TensorInt)
Declaration
public virtual TensorInt And(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | |
TensorInt | B |
Returns
Type | Description |
---|---|
TensorInt |
Implements
ArgMax(TensorFloat, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public virtual TensorInt ArgMax(TensorFloat X, int axis, bool keepdim, bool selectLastIndex = false)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ArgMax(TensorInt, Int32, Boolean, Boolean)
Computes the indices of the maximum elements of the input tensor along a given axis.
Declaration
public virtual TensorInt ArgMax(TensorInt X, int axis, bool keepdim, bool selectLastIndex = false)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ArgMin(TensorFloat, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public virtual TensorInt ArgMin(TensorFloat X, int axis, bool keepdim, bool selectLastIndex = false)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ArgMin(TensorInt, Int32, Boolean, Boolean)
Computes the indices of the minimum elements of the input tensor along a given axis.
Declaration
public virtual TensorInt ArgMin(TensorInt X, int axis, bool keepdim, bool selectLastIndex = false)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Asin(TensorFloat)
Computes an output tensor by applying the element-wise Asin
trigonometric function: f(x) = asin(x).
Declaration
public virtual TensorFloat Asin(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Asinh(TensorFloat)
Computes an output tensor by applying the element-wise Asinh
trigonometric function: f(x) = asinh(x).
Declaration
public virtual TensorFloat Asinh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Atan(TensorFloat)
Computes an output tensor by applying the element-wise Atan
trigonometric function: f(x) = atan(x).
Declaration
public virtual TensorFloat Atan(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Atanh(TensorFloat)
Computes an output tensor by applying the element-wise Atanh
trigonometric function: f(x) = atanh(x).
Declaration
public virtual TensorFloat Atanh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
AveragePool(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 TensorFloat AveragePool(TensorFloat X, int[] pool, int[] stride, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | pool | The size of the kernel along each spatial axis. |
Int32[] | stride | The stride along each spatial axis. |
Int32[] | pad | 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. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
AxisNormalization(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 TensorFloat AxisNormalization(TensorFloat X, TensorFloat S, TensorFloat B, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
Single | epsilon | The epsilon value the layer uses to avoid division by zero. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Bernoulli(TensorFloat, DataType, 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 Tensor Bernoulli(TensorFloat X, DataType dataType, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
DataType | dataType | The data type of the output tensor. |
Nullable<Single> | seed | The optional seed to use for the random number generation. If this is |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Cast(Tensor, DataType)
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 Tensor Cast(Tensor X, DataType toType)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
DataType | toType | The data type to cast to as a |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Cast(TensorFloat)
Declaration
public virtual TensorInt Cast(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorInt |
Cast(TensorInt)
Declaration
public virtual TensorFloat Cast(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X |
Returns
Type | Description |
---|---|
TensorFloat |
Ceil(TensorFloat)
Computes an output tensor by applying the element-wise Ceil
math function: f(x) = ceil(x).
Declaration
public virtual TensorFloat Ceil(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Celu(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 TensorFloat Celu(TensorFloat X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | alpha | The alpha value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Clip(TensorFloat, Single, Single)
Computes an output tensor by applying the element-wise Clip
math function: f(x) = clamp(x, min, max).
Declaration
public virtual TensorFloat Clip(TensorFloat X, float min, float max)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | min | The lower clip value. |
Single | max | The upper clip value. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Compress(Tensor, TensorInt, Int32)
Selects slices of an input tensor along a given axis according to a condition tensor.
Declaration
public virtual Tensor Compress(Tensor X, TensorInt condition, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | condition | |
Int32 | axis | The axis along which to compress. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
CompressWithIndices(Tensor, TensorInt, Int32, Int32)
Declaration
protected virtual Tensor CompressWithIndices(Tensor X, TensorInt indices, int numIndices, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
TensorInt | indices | |
Int32 | numIndices | |
Int32 | axis |
Returns
Type | Description |
---|---|
Tensor |
Concat(Tensor[], Int32)
Calculates an output tensor by concatenating the input tensors along a given axis.
Declaration
public virtual Tensor Concat(Tensor[] tensors, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | The input tensors. |
Int32 | axis | The axis along which to concatenate the input tensors. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
ConstantOfShape(TensorShape, Int32)
Generates a tensor with a given shape filled with a given value.
Declaration
public virtual TensorInt ConstantOfShape(TensorShape X, int value)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | X | The input tensor shape. |
Int32 | value | The fill value. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ConstantOfShape(TensorShape, Single)
Generates a tensor with a given shape filled with a given value.
Declaration
public virtual TensorFloat ConstantOfShape(TensorShape X, float value)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | X | The input tensor shape. |
Single | value | The fill value. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Conv(TensorFloat, TensorFloat, TensorFloat, Int32, Int32[], Int32[], Int32[], FusableActivation)
Applies a convolution filter to an input tensor.
Declaration
public virtual TensorFloat Conv(TensorFloat X, TensorFloat K, TensorFloat B, int groups, int[] stride, int[] pad, int[] dilation, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | K | The filter tensor. |
TensorFloat | B | The optional bias tensor. |
Int32 | groups | The number of groups that input channels and output channels are divided into. |
Int32[] | stride | The optional stride value for each spatial dimension of the filter. |
Int32[] | pad | The optional lower and upper padding values for each spatial dimension of the filter. |
Int32[] | dilation | The optional dilation value of each spatial dimension of the filter. |
FusableActivation | fusedActivation | The fused activation type to apply after the convolution. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Conv2DTrans(TensorFloat, TensorFloat, TensorFloat, Int32[], Int32[], Int32[], FusableActivation)
Applies a transpose convolution filter to an input tensor.
Declaration
public virtual TensorFloat Conv2DTrans(TensorFloat X, TensorFloat K, TensorFloat B, int[] stride, int[] pad, int[] outputAdjustment, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | K | The filter tensor. |
TensorFloat | B | The optional bias tensor. |
Int32[] | stride | The optional stride value for each spatial dimension of the filter. |
Int32[] | pad | The optional lower and upper padding values for each spatial dimension of the filter. |
Int32[] | outputAdjustment | The output padding value for each spatial dimension in the filter. |
FusableActivation | fusedActivation | The fused activation type to apply after the convolution. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Copy(Tensor)
Creates a copy of a given input tensor with the same shape and values.
Declaration
public virtual Tensor Copy(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Cos(TensorFloat)
Computes an output tensor by applying the element-wise Cos
trigonometric function: f(x) = cos(x).
Declaration
public virtual TensorFloat Cos(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Cosh(TensorFloat)
Computes an output tensor by applying the element-wise Cosh
trigonometric function: f(x) = cosh(x).
Declaration
public virtual TensorFloat Cosh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
CumSum(TensorFloat, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public virtual TensorFloat CumSum(TensorFloat X, int axis, bool reverse, bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
CumSum(TensorInt, Int32, Boolean, Boolean)
Performs the cumulative sum along a given axis.
Declaration
public virtual TensorInt CumSum(TensorInt X, int axis, bool reverse, bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Dense(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 TensorFloat Dense(TensorFloat X, TensorFloat W, TensorFloat B, FusableActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | W | The weights tensor. |
TensorFloat | B | The bias tensor. |
FusableActivation | fusedActivation | The fused activation to apply to the output tensor after the dense operation. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
DepthToSpace(TensorFloat, Int32, DepthToSpaceMode)
Computes the output tensor by permuting data from depth into blocks of spatial data.
Declaration
public virtual TensorFloat DepthToSpace(TensorFloat X, int blocksize, DepthToSpaceMode mode)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
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 |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Dispose()
Disposes of the ops and any associated memory.
Declaration
public virtual void Dispose()
Implements
Div(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 TensorFloat Div(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Div(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 TensorInt Div(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Einsum(String, TensorFloat[])
Performs an Einsum
math operation.
Declaration
public virtual TensorFloat Einsum(string equation, params TensorFloat[] operands)
Parameters
Type | Name | Description |
---|---|---|
String | equation | The equation of the Einstein summation as a comma-separated list of subscript labels. |
TensorFloat[] | operands | The input tensors of the Einsum. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Elu(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 TensorFloat Elu(TensorFloat X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Single | alpha | The alpha value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Equal(TensorFloat, TensorFloat)
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 TensorInt Equal(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Equal(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 TensorInt Equal(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Erf(TensorFloat)
Computes an output tensor by applying the element-wise Erf
activation function: f(x) = erf(x).
Declaration
public virtual TensorFloat Erf(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Exp(TensorFloat)
Computes an output tensor by applying the element-wise Exp
math function: f(x) = exp(x).
Declaration
public virtual TensorFloat Exp(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Expand(Tensor, TensorShape)
Calculates an output tensor by broadcasting the input tensor into a given shape.
Declaration
public virtual Tensor Expand(Tensor X, TensorShape newShape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorShape | newShape |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Floor(TensorFloat)
Computes an output tensor by applying the element-wise Floor
math function: f(x) = floor(x).
Declaration
public virtual TensorFloat Floor(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
FMod(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 TensorFloat FMod(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
FMod(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 TensorInt FMod(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Gather(Tensor, TensorInt, Int32)
Takes values from the input tensor indexed by the indices tensor along a given axis and concatenates them.
Declaration
public virtual Tensor Gather(Tensor X, TensorInt indices, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Int32 | axis | The axis along which to gather. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
GatherElements(Tensor, TensorInt, Int32)
Takes values from the input tensor indexed by the indices tensor along a given axis and concatenates them.
Declaration
public virtual Tensor GatherElements(Tensor X, TensorInt indices, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Int32 | axis | The axis along which to gather. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
GatherND(Tensor, TensorInt, Int32)
Takes slices of values from the batched input tensor indexed by the indices
tensor.
Declaration
public virtual Tensor GatherND(Tensor X, TensorInt indices, int batchDims)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Int32 | batchDims | The number of batch dimensions of the input tensor, the gather begins at the next dimension. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Gelu(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 TensorFloat Gelu(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
GlobalAveragePool(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 TensorFloat GlobalAveragePool(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
GlobalAverageVariancePool(TensorFloat, TensorFloat, Int32)
Declaration
public virtual void GlobalAverageVariancePool(TensorFloat O, TensorFloat X, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | O | |
TensorFloat | X | |
Int32 | axis |
GlobalMaxPool(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 TensorFloat GlobalMaxPool(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Greater(TensorFloat, TensorFloat)
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 TensorInt Greater(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Greater(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 TensorInt Greater(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
GreaterOrEqual(TensorFloat, TensorFloat)
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 TensorInt GreaterOrEqual(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
GreaterOrEqual(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 TensorInt GreaterOrEqual(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Hardmax(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 TensorFloat Hardmax(TensorFloat X, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32 | axis | The axis along which to apply the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
HardSigmoid(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 TensorFloat HardSigmoid(TensorFloat X, float alpha, float beta)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | alpha | The alpha value to use for the |
Single | beta | The beta value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
HardSwish(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 TensorFloat HardSwish(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
InstanceNormalization(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 TensorFloat InstanceNormalization(TensorFloat X, TensorFloat S, TensorFloat B, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
Single | epsilon | The epsilon value the layer uses to avoid division by zero. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
IsInf(TensorFloat, 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 TensorInt IsInf(TensorFloat X, bool detectNegative, bool detectPositive)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Boolean | detectNegative | Whether to detect negative infinities in the |
Boolean | detectPositive | Whether to detect positive infinities in the |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
IsNaN(TensorFloat)
Performs an element-wise IsNaN
logical operation: f(x) = 1 if x is NaN, otherwise f(x) = 0.
Declaration
public virtual TensorInt IsNaN(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
LeakyRelu(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 TensorFloat LeakyRelu(TensorFloat X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | alpha | The alpha value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Less(TensorFloat, TensorFloat)
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 TensorInt Less(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Less(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 TensorInt Less(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
LessOrEqual(TensorFloat, TensorFloat)
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 TensorInt LessOrEqual(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
LessOrEqual(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 TensorInt LessOrEqual(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Log(TensorFloat)
Computes an output tensor by applying the element-wise Log
math function: f(x) = log(x).
Declaration
public virtual TensorFloat Log(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
LogSoftmax(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 TensorFloat LogSoftmax(TensorFloat X, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32 | axis | The axis along which to apply the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
LRN(TensorFloat, Single, Single, Single, Int32)
Normalizes the input tensor over local input regions.
Declaration
public virtual TensorFloat LRN(TensorFloat X, float alpha, float beta, float bias, int size)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
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. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
LSTM(TensorFloat, TensorFloat, TensorFloat, TensorFloat, TensorInt, 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 TensorFloat[] LSTM(TensorFloat X, TensorFloat W, TensorFloat R, TensorFloat B, TensorInt sequenceLens, TensorFloat initialH, TensorFloat initialC, TensorFloat P, RnnDirection direction, RnnActivation[] activations, float[] activationAlpha, float[] activationBeta, bool inputForget, float clip = 3.40282347E+38F, RnnLayout layout = RnnLayout.SequenceFirst)
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 |
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 |
Returns
Type | Description |
---|---|
TensorFloat[] | The computed output tensor. |
Implements
MatMul(TensorFloat, TensorFloat)
Performs a multi-dimensional matrix multiplication operation: f(a, b) = a x b.
Declaration
public virtual TensorFloat MatMul(TensorFloat X, TensorFloat Y)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The first input tensor. |
TensorFloat | Y | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
MatMul2D(TensorFloat, Boolean, TensorFloat, Boolean)
Performs a matrix multiplication operation with optional transposes: f(a, b) = a' x b'.
Declaration
public virtual TensorFloat MatMul2D(TensorFloat X, bool xTranspose, TensorFloat Y, bool yTranspose)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The first input tensor. |
Boolean | xTranspose | Whether to transpose the first input tensor before performing the matrix multiplication. |
TensorFloat | Y | |
Boolean | yTranspose | Whether to transpose the second input tensor before performing the matrix multiplication. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Max(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 TensorFloat Max(TensorFloat[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Max(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 TensorInt Max(TensorInt[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
MaxPool(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 TensorFloat MaxPool(TensorFloat X, int[] pool, int[] stride, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | pool | The size of the kernel along each spatial axis. |
Int32[] | stride | The stride along each spatial axis. |
Int32[] | pad | 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. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Mean(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 TensorFloat Mean(TensorFloat[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
MemCopy(Tensor, Tensor, 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
protected virtual void MemCopy(Tensor X, Tensor O, int length = -1, int offsetX = 0, int offsetO = 0)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | O | |
Int32 | length | |
Int32 | offsetX | |
Int32 | offsetO |
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
protected virtual void MemCopyStride(Tensor X, Tensor O, int strideX, int strideO, int length, int count, int offsetX = 0, int offsetO = 0)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | O | |
Int32 | strideX | |
Int32 | strideO | |
Int32 | length | |
Int32 | count | |
Int32 | offsetX | |
Int32 | offsetO |
MemSet(Tensor, Int32, Int32, Int32)
Set values of O in indices [offset0, offsetO + length] to value
Declaration
protected virtual void MemSet(Tensor O, int value, int length = -1, int offsetO = 0)
Parameters
Type | Name | Description |
---|---|---|
Tensor | O | |
Int32 | value | |
Int32 | length | |
Int32 | offsetO |
Min(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 TensorFloat Min(TensorFloat[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Min(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 TensorInt Min(TensorInt[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Mod(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 TensorInt Mod(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Mul(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 TensorFloat Mul(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Mul(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 TensorInt Mul(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Multinomial(TensorFloat, Int32, Nullable<Single>)
Generates an output tensor with values from a multinomial distribution according to the probabilities given by the input tensor.
Declaration
public virtual TensorInt Multinomial(TensorFloat X, int count, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Int32 | count | The number of times to sample the input. |
Nullable<Single> | seed | The optional seed to use for the random number generation. If this is |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Neg(TensorFloat)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public virtual TensorFloat Neg(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Neg(TensorInt)
Computes an output tensor by applying the element-wise Neg
math function: f(x) = -x.
Declaration
public virtual TensorInt Neg(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
NewOutputTensor(TensorShape, DataType)
Allocate a new Tensor
of a given shape and data type using the AllocScope.LayerOutput
scope.
Declaration
protected Tensor NewOutputTensor(TensorShape shape, DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
DataType | dataType |
Returns
Type | Description |
---|---|
Tensor |
NewOutputTensorFloat(TensorShape)
Allocate a new TensorFloat
of a given shape using the AllocScope.LayerOutput
scope.
Declaration
protected TensorFloat NewOutputTensorFloat(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorFloat |
NewOutputTensorInt(TensorShape)
Allocate a new TensorInt
of a given shape using the AllocScope.LayerOutput
scope.
Declaration
protected TensorInt NewOutputTensorInt(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorInt |
NewTempTensorFloat(TensorShape)
Allocate a new TensorFloat
of a given shape using the AllocScope.InternalToLayer
scope.
Declaration
protected TensorFloat NewTempTensorFloat(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorFloat |
NewTempTensorInt(TensorShape)
Allocate a new TensorInt
of a given shape using the AllocScope.InternalToLayer
scope.
Declaration
protected TensorInt NewTempTensorInt(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape |
Returns
Type | Description |
---|---|
TensorInt |
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
NewTensorFloat(TensorShape, AllocScope)
Allocate a new TensorFloat
of a given shape.
Declaration
protected TensorFloat NewTensorFloat(TensorShape shape, AllocScope scope)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
AllocScope | scope |
Returns
Type | Description |
---|---|
TensorFloat |
NewTensorInt(TensorShape, AllocScope)
Allocate a new TensorInt
of a given shape.
Declaration
protected TensorInt NewTensorInt(TensorShape shape, AllocScope scope)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | |
AllocScope | scope |
Returns
Type | Description |
---|---|
TensorInt |
NonMaxSuppression(TensorFloat, TensorFloat, Int32, Single, Single, CenterPointBox)
Calculates an output tensor of selected indices of boxes from input boxes
and scores
tensors where the indices are based on the scores and amount of intersection with previously selected boxes.
Declaration
public virtual TensorInt NonMaxSuppression(TensorFloat boxes, TensorFloat scores, int maxOutputBoxesPerClass = 0, float iouThreshold = 0F, float scoreThreshold = 0F, CenterPointBox centerPointBox = CenterPointBox.Corners)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | boxes | The boxes input tensor. |
TensorFloat | scores | The scores input tensor. |
Int32 | maxOutputBoxesPerClass | The maximum number of boxes to return for each class. |
Single | iouThreshold | The threshold above which the intersect-over-union rejects a box. |
Single | scoreThreshold | The threshold below which the box score filters a box from the output. |
CenterPointBox | centerPointBox | The format the |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
NonZero(TensorFloat)
Returns the indices of the elements of the input tensor that are not zero.
Declaration
public TensorInt NonZero(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
NonZero(TensorInt)
Returns the indices of the elements of the input tensor that are not zero.
Declaration
public TensorInt NonZero(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Not(TensorInt)
Performs an element-wise Not
logical operation: f(x) = ~x.
Declaration
public virtual TensorInt Not(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
OneHot(TensorInt, Int32, Int32, Int32, Int32)
Generates a one-hot tensor with a given depth
, indices
and on and off values.
Declaration
public virtual TensorInt OneHot(TensorInt X, int axis, int depth, int offValue, int onValue)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | |
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. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Or(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 TensorInt Or(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Pad(TensorFloat, 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 TensorFloat Pad(TensorFloat X, int[] pad, PadMode padMode, float constant)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | pad | The lower and upper padding values for each dimension. |
PadMode | padMode | The |
Single | constant | The constant value to fill with when using |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
PinToDevice(Tensor, Boolean)
Prepares Tensor
for use with CPU backend.
Declaration
public virtual Tensor PinToDevice(Tensor X, bool uploadCache = true)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
|
Boolean | uploadCache | Whether to copy tensor data to CPU backend. |
Returns
Type | Description |
---|---|
Tensor |
|
Implements
PostLayerCleanup()
Called after every layer execution. It allows IOps to run cleanup operations such as clearing temporary buffers only used in the scope of the last layer executed.
Declaration
public virtual void PostLayerCleanup()
Implements
Pow(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 TensorFloat Pow(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Pow(TensorFloat, TensorInt)
Performs an element-wise Pow
math operation: f(a, b) = pow(a, b).
This supports numpy-style broadcasting of input tensors.
Declaration
public virtual TensorFloat Pow(TensorFloat A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
PRelu(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 TensorFloat PRelu(TensorFloat X, TensorFloat S)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
TensorFloat | S |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
RandomNormal(TensorShape, 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 TensorFloat RandomNormal(TensorShape s, float mean, float scale, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | s | |
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 |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
RandomUniform(TensorShape, 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 TensorFloat RandomUniform(TensorShape s, float low, float high, float? seed)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | s | |
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 |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Range(Int32, Int32, Int32)
Generates a 1D output tensor where the values form an arithmetic progression defined by the start
, limit
, and delta
values.
Declaration
public virtual TensorInt Range(int start, int limit, int delta)
Parameters
Type | Name | Description |
---|---|---|
Int32 | start | The first value in the range. |
Int32 | limit | The limit of the range. |
Int32 | delta | The delta between subsequent values in the range. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Range(Single, Single, Single)
Generates a 1D output tensor where the values form an arithmetic progression defined by the start
, limit
, and delta
values.
Declaration
public virtual TensorFloat Range(float start, float limit, float delta)
Parameters
Type | Name | Description |
---|---|---|
Single | start | The first value in the range. |
Single | limit | The limit of the range. |
Single | delta | The delta between subsequent values in the range. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Reciprocal(TensorFloat)
Computes an output tensor by applying the element-wise Reciprocal
math function: f(x) = 1 / x.
Declaration
public virtual TensorFloat Reciprocal(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceL1(TensorFloat, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceL1
operation: f(x1, x2 ... xn) = |x1| + |x2| + ... + |xn|.
Declaration
public virtual TensorFloat ReduceL1(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceL1(TensorInt, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceL1
operation: f(x1, x2 ... xn) = |x1| + |x2| + ... + |xn|.
Declaration
public virtual TensorInt ReduceL1(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ReduceL2(TensorFloat, 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 TensorFloat ReduceL2(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceLogSum(TensorFloat, 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 TensorFloat ReduceLogSum(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceLogSumExp(TensorFloat, 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 TensorFloat ReduceLogSumExp(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceMax(TensorFloat, 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 TensorFloat ReduceMax(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceMax(TensorInt, 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 TensorInt ReduceMax(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ReduceMean(TensorFloat, 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 TensorFloat ReduceMean(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceMin(TensorFloat, 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 TensorFloat ReduceMin(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceMin(TensorInt, 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 TensorInt ReduceMin(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ReduceProd(TensorFloat, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceProd
operation: f(x1, x2 ... xn) = x1 * x2 * ... * xn.
Declaration
public virtual TensorFloat ReduceProd(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceProd(TensorInt, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceProd
operation: f(x1, x2 ... xn) = x1 * x2 * ... * xn.
Declaration
public virtual TensorInt ReduceProd(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ReduceSum(TensorFloat, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceSum
operation: f(x1, x2 ... xn) = x1 + x2 + ... + xn.
Declaration
public virtual TensorFloat ReduceSum(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceSum(TensorInt, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceSum
operation: f(x1, x2 ... xn) = x1 + x2 + ... + xn.
Declaration
public virtual TensorInt ReduceSum(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
ReduceSumSquare(TensorFloat, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceSumSquare
operation: f(x1, x2 ... xn) = x1² + x2² + ... + xn².
Declaration
public virtual TensorFloat ReduceSumSquare(TensorFloat X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ReduceSumSquare(TensorInt, Int32[], Boolean)
Reduces an input tensor along the given axes using the ReduceSumSquare
operation: f(x1, x2 ... xn) = x1² + x2² + ... + xn².
Declaration
public virtual TensorInt ReduceSumSquare(TensorInt X, int[] axes, bool keepdim)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Int32[] | axes | The axes along which to reduce. |
Boolean | keepdim | Whether to keep the reduced axes in the output tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Relu(TensorFloat)
Computes an output tensor by applying the element-wise Relu
activation function: f(x) = max(0, x).
Declaration
public virtual TensorFloat Relu(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Relu6(TensorFloat)
Computes an output tensor by applying the element-wise Relu6
activation function: f(x) = clamp(x, 0, 6).
Declaration
public virtual TensorFloat Relu6(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ResetAllocator(Boolean)
Resets the internal allocator.
Declaration
public virtual void ResetAllocator(bool keepCachedMemory = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | keepCachedMemory |
Implements
Reshape(Tensor, TensorShape)
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 Tensor Reshape(Tensor X, TensorShape newShape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorShape | newShape |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Resize(TensorFloat, Single[], InterpolationMode, NearestMode, CoordTransformMode)
Calculates an output tensor by resampling the input tensor along the spatial dimensions with given scales.
Declaration
public virtual TensorFloat Resize(TensorFloat X, float[] scale, InterpolationMode interpolationMode, NearestMode nearestMode = NearestMode.RoundPreferFloor, CoordTransformMode coordTransformMode = CoordTransformMode.HalfPixel)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Single[] | scale | The factor to scale each dimension by. |
InterpolationMode | interpolationMode | The |
NearestMode | nearestMode | The |
CoordTransformMode | coordTransformMode | The |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
RoiAlign(TensorFloat, TensorFloat, TensorInt, 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 TensorFloat RoiAlign(TensorFloat X, TensorFloat Rois, TensorInt Indices, 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. |
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. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Round(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 TensorFloat Round(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ScaleBias(TensorFloat, TensorFloat, TensorFloat)
Computes the output tensor with an element-wise ScaleBias
function: f(x, s, b) = x * s + b.
Declaration
public virtual TensorFloat ScaleBias(TensorFloat X, TensorFloat S, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | S | The scale tensor. |
TensorFloat | B | The bias tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ScatterElements(Tensor, TensorInt, 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 Tensor ScatterElements(Tensor X, TensorInt indices, Tensor updates, int axis, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
TensorInt | indices | The indices tensor. |
Tensor | updates | The updates tensor. |
Int32 | axis | The axis on which to perform the scatter. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
ScatterND(TensorFloat, TensorInt, 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 TensorFloat ScatterND(TensorFloat X, TensorInt indices, TensorFloat updates, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorInt | indices | The indices tensor. |
TensorFloat | updates | The updates tensor. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ScatterND(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 TensorInt ScatterND(TensorInt X, TensorInt indices, TensorInt updates, ScatterReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
TensorInt | indices | The indices tensor. |
TensorInt | updates | The updates tensor. |
ScatterReductionMode | reduction | The reduction mode used to update the values as a |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Selu(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 TensorFloat Selu(TensorFloat X, float alpha, float gamma)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | alpha | The alpha value to use for the |
Single | gamma | The alpha value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Shape(Tensor, Int32, Int32)
Calculates the shape of an input tensor as a 1D TensorInt
.
Declaration
public virtual TensorInt Shape(Tensor X, int start = 0, int end = 8)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32 | start | The inclusive start axis for slicing the shape of the input tensor. The default value is 0. |
Int32 | end | The exclusive end axis for slicing the shape of the input tensor. The default value is 8. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Shrink(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 TensorFloat Shrink(TensorFloat X, float bias, float lambd)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | bias | The bias value to use for the |
Single | lambd | The lambda value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sigmoid(TensorFloat)
Computes an output tensor by applying the element-wise Sigmoid
activation function: f(x) = 1/(1 + e^(-x)).
Declaration
public virtual TensorFloat Sigmoid(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sign(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 TensorFloat Sign(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sign(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 TensorInt Sign(TensorInt X)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Sin(TensorFloat)
Computes an output tensor by applying the element-wise Sin
trigonometric function: f(x) = sin(x).
Declaration
public virtual TensorFloat Sin(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
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)
Computes an output tensor by applying the element-wise Sinh
trigonometric function: f(x) = sinh(x).
Declaration
public virtual TensorFloat Sinh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Size(TensorShape)
Calculates the number of elements of an input tensor shape as a scalar TensorInt
.
Declaration
public virtual TensorInt Size(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | The input tensor shape. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Slice(Tensor, Int32[], Int32[], Int32[], Int32[])
Calculates an output tensor by slicing the input tensor along given axes with given starts, ends, and steps.
Declaration
public virtual Tensor Slice(Tensor X, int[] starts, int[] ends, int[] axes, int[] steps)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32[] | starts | The start index along each axis. |
Int32[] | ends | The end index along each axis. |
Int32[] | axes | The axes along which to slice. If this is |
Int32[] | steps | The step values for slicing. If this is |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Softmax(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 TensorFloat Softmax(TensorFloat X, int axis)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Int32 | axis | The axis along which to apply the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Softplus(TensorFloat)
Computes an output tensor by applying the element-wise Softplus
activation function: f(x) = ln(e^x + 1).
Declaration
public virtual TensorFloat Softplus(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Softsign(TensorFloat)
Computes an output tensor by applying the element-wise Softsign
activation function: f(x) = x/(|x| + 1).
Declaration
public virtual TensorFloat Softsign(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
SpaceToDepth(TensorFloat, Int32)
Computes the output tensor by permuting data from blocks of spatial data into depth.
Declaration
public virtual TensorFloat SpaceToDepth(TensorFloat X, int blocksize)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Int32 | blocksize | The size of the blocks to move the depth data into. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Split(Tensor, Int32, Int32, Int32)
Calculates an output tensor by splitting the input tensor along a given axis between start and end.
Declaration
public virtual Tensor Split(Tensor X, int axis, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32 | axis | The axis along which to split the input tensor. |
Int32 | start | The inclusive start value for the split. |
Int32 | end | The exclusive end value for the split. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Sqrt(TensorFloat)
Computes an output tensor by applying the element-wise Sqrt
math function: f(x) = sqrt(x).
Declaration
public virtual TensorFloat Sqrt(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Square(TensorFloat)
Computes an output tensor by applying the element-wise Square
math function: f(x) = x * x.
Declaration
public virtual TensorFloat Square(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sub(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 TensorFloat Sub(TensorFloat A, TensorFloat B)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | A | The first input tensor. |
TensorFloat | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sub(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 TensorInt Sub(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |
Implements
Sum(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 TensorFloat Sum(TensorFloat[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat[] | tensors | The input tensors. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Sum(TensorInt[])
Declaration
public virtual TensorInt Sum(TensorInt[] tensors)
Parameters
Type | Name | Description |
---|---|---|
TensorInt[] | tensors |
Returns
Type | Description |
---|---|
TensorInt |
Swish(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 TensorFloat Swish(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Tan(TensorFloat)
Computes an output tensor by applying the element-wise Tan
trigonometric function: f(x) = tan(x).
Declaration
public virtual TensorFloat Tan(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Tanh(TensorFloat)
Computes an output tensor by applying the element-wise Tanh
activation function: f(x) = tanh(x).
Declaration
public virtual TensorFloat Tanh(TensorFloat X)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
ThresholdedRelu(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 TensorFloat ThresholdedRelu(TensorFloat X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | |
Single | alpha | The alpha value to use for the |
Returns
Type | Description |
---|---|
TensorFloat | The computed output tensor. |
Implements
Tile(Tensor, Int32[])
Calculates an output tensor by repeating the input layer a given number of times along each axis.
Declaration
public virtual Tensor Tile(Tensor X, int[] repeats)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32[] | repeats | The number of times to tile the input tensor along each axis. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
TopK(TensorFloat, Int32, Int32, Boolean, Boolean)
Calculates the top-K largest or smallest elements of an input tensor along a given axis.
Declaration
public virtual Tensor[] TopK(TensorFloat X, int k, int axis, bool largest, bool sorted)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | 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 |
Boolean | sorted | Whether to return the elements in sorted order. |
Returns
Type | Description |
---|---|
Tensor[] | The computed output tensor. |
Implements
Transpose(Tensor)
Calculates an output tensor by reversing the dimensions of the input tensor.
Declaration
public virtual Tensor Transpose(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Transpose(Tensor, Int32[])
Calculates an output tensor by permuting the axes and data of the input tensor according to the given permutations.
Declaration
public virtual Tensor Transpose(Tensor X, int[] permutations)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | permutations | The axes to sample the output tensor from in the input tensor. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Tril(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 Tensor Tril(Tensor X, int k)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32 | k | The offset from the diagonal to keep. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Triu(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 Tensor Triu(Tensor X, int k)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input tensor. |
Int32 | k | The offset from the diagonal to exclude. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Where(TensorInt, 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 Tensor Where(TensorInt C, Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | C | The condition tensor. |
Tensor | A | The first input tensor. |
Tensor | B | The second input tensor. |
Returns
Type | Description |
---|---|
Tensor | The computed output tensor. |
Implements
Xor(TensorInt, TensorInt)
Performs an element-wise Xor
logical operation: f(a) = a ^ b.
Declaration
public virtual TensorInt Xor(TensorInt A, TensorInt B)
Parameters
Type | Name | Description |
---|---|---|
TensorInt | A | The first input tensor. |
TensorInt | B | The second input tensor. |
Returns
Type | Description |
---|---|
TensorInt | The computed output tensor. |