Class ReferenceCPUOps
Reference CPU implementation of IOps
Inherited Members
Namespace: Unity.Barracuda
Syntax
public class ReferenceCPUOps : IOps, IOpsStatistics
Constructors
ReferenceCPUOps(ITensorAllocator)
Create ReferenceCPUOps
Declaration
public ReferenceCPUOps(ITensorAllocator allocator = null)
Parameters
Type | Name | Description |
---|---|---|
ITensorAllocator | allocator | allocator |
Methods
Abs(Tensor)
Abs
Declaration
public virtual Tensor Abs(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Acos(Tensor)
Acos
Declaration
public virtual Tensor Acos(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Acosh(Tensor)
Acosh
Declaration
public virtual Tensor Acosh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Add(Tensor[])
Add tensors
together
Declaration
public virtual Tensor Add(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ArgMax(Tensor, Int32)
ArgMax
Declaration
public virtual Tensor ArgMax(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ArgMin(Tensor, Int32)
ArgMax
Declaration
public virtual Tensor ArgMin(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Asin(Tensor)
Asin
Declaration
public virtual Tensor Asin(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Asinh(Tensor)
Asinh
Declaration
public virtual Tensor Asinh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Atan(Tensor)
Atan
Declaration
public virtual Tensor Atan(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Atanh(Tensor)
Atanh
Declaration
public virtual Tensor Atanh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
AvgPool2D(Tensor, Int32[], Int32[], Int32[])
2D average pooling
Declaration
public virtual Tensor AvgPool2D(Tensor X, int[] pool, int[] stride, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pool | pooling |
Int32[] | stride | stride |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Bernoulli(Single)
Bernoulli distribution
Declaration
protected float Bernoulli(float p)
Parameters
Type | Name | Description |
---|---|---|
Single | p | p |
Returns
Type | Description |
---|---|
Single | random value |
Border2D(Tensor, Int32[], Single)
2D border padding
Declaration
public virtual Tensor Border2D(Tensor X, int[] pad, float value)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Single | value |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Border3D(Tensor, Int32[], Single)
3D border padding
Declaration
public virtual Tensor Border3D(Tensor X, int[] pad, float value)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Single | value |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Ceil(Tensor)
Ceil
Declaration
public virtual Tensor Ceil(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Clip(Tensor, Single, Single)
Clip
Declaration
public virtual Tensor Clip(Tensor X, float min, float max)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | min | min value |
Single | max | max value |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Concat(Tensor[], Int32)
Concatenate tensors
across axis
Declaration
public virtual Tensor Concat(Tensor[] tensors, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ConstantOfShape(TensorShape, DataType, Single)
Creates a constant of shape input
Declaration
public virtual Tensor ConstantOfShape(TensorShape X, DataType type, float value = 0F)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | X | input shape |
DataType | type | Tensor DataType |
Single | value | value |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Conv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)
2D convolution
Declaration
public virtual Tensor Conv2D(Tensor X, Tensor K, Tensor B, int[] stride, int[] pad, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | K | |
Tensor | B | |
Int32[] | stride | stride |
Int32[] | pad | padding |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Conv2DTrans(Tensor, Tensor, Tensor, Int32[], Int32[], Int32[], Layer.FusedActivation)
Transpose 2D convolution
Declaration
public virtual Tensor Conv2DTrans(Tensor X, Tensor K, Tensor B, int[] stride, int[] pad, int[] outputAdjustment, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | K | |
Tensor | B | |
Int32[] | stride | stride |
Int32[] | pad | padding |
Int32[] | outputAdjustment | output adjustments |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Conv3D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)
3D convolution
Declaration
public virtual Tensor Conv3D(Tensor X, Tensor K, Tensor B, int[] stride, int[] pad, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | K | |
Tensor | B | |
Int32[] | stride | stride |
Int32[] | pad | padding |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Copy(Tensor)
Copy
Declaration
public virtual Tensor Copy(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
CopyAndReshape(Tensor, TensorShape)
Copy and reshape Tensor
Declaration
protected virtual Tensor CopyAndReshape(Tensor X, TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
TensorShape | shape | shape |
Returns
Type | Description |
---|---|
Tensor | output |
Cos(Tensor)
Cos
Declaration
public virtual Tensor Cos(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Cosh(Tensor)
Cosh
Declaration
public virtual Tensor Cosh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Dense(Tensor, Tensor, Tensor, Layer.FusedActivation)
Dense layer (matrix multiplication) o = x
⨯ w
+ b
Declaration
public virtual Tensor Dense(Tensor X, Tensor W, Tensor B, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | W | |
Tensor | B | |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Dense3(Tensor, Tensor, Tensor)
rank3 Dense layer (matrix multiplication) o = x
⨯ w
+ b
O: N,,W,C / X: N,,W,C / W:N,,,C / B:N,,,_
Declaration
public virtual Tensor Dense3(Tensor X, Tensor W, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | W | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
DepthToSpace(Tensor, Int32[], Layer.DepthToSpaceMode)
Depth to space
Declaration
public virtual Tensor DepthToSpace(Tensor X, int[] blocksize, Layer.DepthToSpaceMode mode)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | blocksize | |
Layer.DepthToSpaceMode | mode | mode |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
DepthwiseConv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)
Depthwise 2D convolution
Declaration
public virtual Tensor DepthwiseConv2D(Tensor X, Tensor K, Tensor B, int[] stride, int[] pad, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | K | |
Tensor | B | |
Int32[] | stride | stride |
Int32[] | pad | padding |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Div(Tensor[])
Divide tensors o = tensors[0] / tensors[1] / ... / tensors[N-1]
Declaration
public virtual Tensor Div(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Dropout(Tensor, Single)
Dropout
Declaration
public virtual Tensor Dropout(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Elu(Tensor, Single)
ELU
Declaration
public virtual Tensor Elu(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Equal(Tensor, Tensor)
Equal
Declaration
public virtual Tensor Equal(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
Erf(Tensor)
Erf
Declaration
public virtual Tensor Erf(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Exp(Tensor)
Exponent e^x
Declaration
public virtual Tensor Exp(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Expand(Tensor, TensorShape)
Expand
Declaration
public virtual Tensor Expand(Tensor X, TensorShape newShape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
TensorShape | newShape |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Flatten(Tensor)
Flatten
Declaration
public virtual Tensor Flatten(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Floor(Tensor)
Floor
Declaration
public virtual Tensor Floor(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Gather(Tensor[], Int32)
Gather
Declaration
public virtual Tensor Gather(Tensor[] tensors, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Gaussian(Single, Single)
Gaussian distribution
Declaration
protected float Gaussian(float mean, float stdDev)
Parameters
Type | Name | Description |
---|---|---|
Single | mean | mean |
Single | stdDev | standard deviation |
Returns
Type | Description |
---|---|
Single | random value |
GetModelExecutionsReporter()
Get model executions reporter
Declaration
public IModelExecutionsReporter GetModelExecutionsReporter()
Returns
Type | Description |
---|---|
IModelExecutionsReporter | model executions reporter |
Implements
GlobalAvgPool2D(Tensor)
2D global average pooling
Declaration
public virtual Tensor GlobalAvgPool2D(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
GlobalAvgVariancePool2D(Tensor)
2D global average variance pooling
Declaration
public virtual Tensor GlobalAvgVariancePool2D(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
GlobalMaxPool2D(Tensor)
2D global max pooling
Declaration
public virtual Tensor GlobalMaxPool2D(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Greater(Tensor, Tensor)
Greater
Declaration
public virtual Tensor Greater(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
GreaterEqual(Tensor, Tensor)
Greater or equal
Declaration
public virtual Tensor GreaterEqual(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
HardSigmoid(Tensor, Single, Single)
HardSigmoid
Declaration
public virtual Tensor HardSigmoid(Tensor X, float alpha, float beta)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Single | beta |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
IsFusedActivationSupported(Layer.FusedActivation)
Check if fusedActivation
is supported in-place
Declaration
protected virtual bool IsFusedActivationSupported(Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Boolean |
|
LeakyRelu(Tensor, Single)
Leaky ReLU
Declaration
public virtual Tensor LeakyRelu(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Less(Tensor, Tensor)
Less
Declaration
public virtual Tensor Less(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
LessEqual(Tensor, Tensor)
Less or equal
Declaration
public virtual Tensor LessEqual(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
Log(Tensor)
Log
Declaration
public virtual Tensor Log(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
LogicalAnd(Tensor, Tensor)
And
Declaration
public virtual Tensor LogicalAnd(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
LogicalNot(Tensor)
Not
Declaration
public virtual Tensor LogicalNot(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor with !x values |
Implements
LogicalOr(Tensor, Tensor)
Or
Declaration
public virtual Tensor LogicalOr(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
LogicalXor(Tensor, Tensor)
Xor
Declaration
public virtual Tensor LogicalXor(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Implements
LogSoftmax(Tensor, Int32)
LogSoftmax
Declaration
public virtual Tensor LogSoftmax(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
LRN(Tensor, Single, Single, Single, Int32)
LRN (Local Response Normalization)
Declaration
public virtual Tensor LRN(Tensor X, float alpha, float beta, float bias, int size)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Single | beta | beta |
Single | bias | bias |
Int32 | size | size |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
LSTM(Tensor, Tensor[], Tensor[], Tensor[], Tensor[], Tensor, Tensor)
LSTM
Declaration
public virtual Tensor[] LSTM(Tensor X, Tensor[] W, Tensor[] R, Tensor[] Wb, Tensor[] Rb, Tensor hidden, Tensor cell)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | The input sequences packed into one 3-D tensor. |
Tensor[] | W | W parameter weight matrix for input, output, forget, and cell gates - W[iofc] |
Tensor[] | R | R recurrence weight matrix for input, output, forget, and cell gates - R[iofc] |
Tensor[] | Wb | W bias vectors for input, output, forget, and cell gates - Wb[iofc] |
Tensor[] | Rb | R bias vectors for input, output, forget, and cell gates - Rb[iofc] |
Tensor | hidden | Initial value of the hidden |
Tensor | cell | Initial value of the cell |
Returns
Type | Description |
---|---|
Tensor[] | [Y (concatenated intermediate values of the hidden), Y_h (final hidden), Y_c (final cell)] |
Implements
MatMul(Tensor, Boolean, Tensor, Boolean)
Simple 2D matrix multiplication O = X
⨯ Y
Declaration
public virtual Tensor MatMul(Tensor X, bool xTranspose, Tensor Y, bool yTranspose)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | left Tensor |
Boolean | xTranspose |
|
Tensor | Y | right Tensor |
Boolean | yTranspose |
|
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
MatMul(Tensor, Int32, Tensor, Int32)
Multidimensional Matrix multiplication o = x
⨯ y
Declaration
public virtual Tensor MatMul(Tensor X, int rankX, Tensor Y, int rankY)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | rankX | rank of |
Tensor | Y | |
Int32 | rankY | rank of |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Max(Tensor[])
Max
Declaration
public virtual Tensor Max(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
MaxPool2D(Tensor, Int32[], Int32[], Int32[])
2D max pooling
Declaration
public virtual Tensor MaxPool2D(Tensor X, int[] pool, int[] stride, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pool | pooling |
Int32[] | stride | stride |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Mean(Tensor[])
Mean
Declaration
public virtual Tensor Mean(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Min(Tensor[])
Min
Declaration
public virtual Tensor Min(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Mul(Tensor[])
Multiply tensors together
Declaration
public virtual Tensor Mul(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Multinomial(Tensor, Int32, Int32)
Multinomial random distribution
Declaration
public virtual Tensor Multinomial(Tensor X, int count, int seed)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | count | count |
Int32 | seed | seed |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Neg(Tensor)
Neg
Declaration
public virtual Tensor Neg(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
NewOutputTensor(DataType, TensorShape, String)
Allocate new Tensor
via allocator using AllocScope.LayerOutput scope
Declaration
protected Tensor NewOutputTensor(DataType type, TensorShape s, string name = "")
Parameters
Type | Name | Description |
---|---|---|
DataType | type | data type |
TensorShape | s | shape of the tensor to be created |
String | name | tensor name |
Returns
Type | Description |
---|---|
Tensor | new |
NewTempTensor(DataType, TensorShape, String)
Allocate new Tensor
via allocator using AllocScope.InternalToLayer scope
Declaration
protected Tensor NewTempTensor(DataType type, TensorShape s, string name = "")
Parameters
Type | Name | Description |
---|---|---|
DataType | type | data type |
TensorShape | s | shape of the tensor to be created |
String | name | tensor name |
Returns
Type | Description |
---|---|
Tensor | new |
NewTensor(DataType, TensorShape, AllocScope, String)
Allocate new Tensor
via allocator
Declaration
protected Tensor NewTensor(DataType dataType, TensorShape s, AllocScope scope, string name = "")
Parameters
Type | Name | Description |
---|---|---|
DataType | dataType | data type |
TensorShape | s | shape |
AllocScope | scope | tensor lifetime scope |
String | name | name |
Returns
Type | Description |
---|---|
Tensor | new |
NewTensorForFusedActivation(DataType, TensorShape, Layer.FusedActivation)
Allocate new Tensor
via allocator
tensor lifetime will be OutputLayer if activation is supported in place, InternalToLayer otherwise.
Declaration
protected Tensor NewTensorForFusedActivation(DataType dataType, TensorShape shape, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
DataType | dataType | data type |
TensorShape | shape | shape of the tensor to be created |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | new |
NewTensorLike(Tensor, AllocScope)
Allocate new Tensor
similar to specified Tensor
t
Declaration
protected Tensor NewTensorLike(Tensor t, AllocScope scope)
Parameters
Type | Name | Description |
---|---|---|
Tensor | t |
|
AllocScope | scope | tensor lifetime scope |
Returns
Type | Description |
---|---|
Tensor | new |
NewTensorLike(Tensor[], AllocScope, Boolean)
Allocate new Tensor
corresponding to max shape of specified tensors
Declaration
protected Tensor NewTensorLike(Tensor[] tensors, AllocScope scope, bool validateType = true)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | tensors |
AllocScope | scope | tensor lifetime scope |
Boolean | validateType | should this method validate that all tensors are the same type |
Returns
Type | Description |
---|---|
Tensor | new |
NonMaxSuppression(Tensor[], Int32, Single, Single, Int32)
Non max suppression tensors[0] - boxes, tensors[1] - scores
Declaration
public Tensor NonMaxSuppression(Tensor[] tensors, int maxOutputBoxesPerClass, float iouThreshold, float scoreThreshold, int centerPointBox)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | |
Int32 | maxOutputBoxesPerClass | max output boxes per class |
Single | iouThreshold | IOU (Intersection Over Union) threshold |
Single | scoreThreshold | score threshold |
Int32 | centerPointBox | center point box |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
NonZero(Tensor)
Indices for non zero values
Declaration
public Tensor NonZero(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Normalization(Tensor, Tensor, Tensor, Int32, Int32, Single, Layer.FusedActivation)
Normalization
Declaration
public virtual Tensor Normalization(Tensor X, Tensor S, Tensor B, int pool, int axis, float epsilon, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S | |
Tensor | B | |
Int32 | pool | pooling |
Int32 | axis | axis |
Single | epsilon | threshold |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
OneHot(Tensor, Int32, Single, Single, Int32)
One hot
Declaration
public virtual Tensor OneHot(Tensor X, int depth, float onValue, float offValue, int inputRank = -1)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | depth | output depth |
Single | onValue | on value |
Single | offValue | off value |
Int32 | inputRank | input rank helper |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Pad2DEdge(Tensor, Int32[])
Edge padding
Declaration
public virtual Tensor Pad2DEdge(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Pad2DReflect(Tensor, Int32[])
Reflection padding
Declaration
public virtual Tensor Pad2DReflect(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Pad2DSymmetric(Tensor, Int32[])
Symmetric padding
Declaration
public virtual Tensor Pad2DSymmetric(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output 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(Tensor, Single)
Power
Declaration
public virtual Tensor Pow(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Pow(Tensor[])
Raise tensors to the power o =tensors[0] ^ tensors[1] ^ ... ^ tensors[N-1]
Declaration
public virtual Tensor Pow(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
PRelu(Tensor, Tensor)
PReLU
Declaration
public virtual Tensor PRelu(Tensor X, Tensor S)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Prepare(Tensor)
Prepares tensor for use
Declaration
public virtual Tensor Prepare(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor |
Implements
PrepareNoAlloc(Tensor)
Prepares tensor for use without uploading internal data to device
Declaration
public virtual Tensor PrepareNoAlloc(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor |
Implements
RandomNormal(TensorShape, Single, Single, Int32)
Normal random distribution
Declaration
public virtual Tensor RandomNormal(TensorShape s, float mean, float scale, int seed)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | s | shape |
Single | mean | mean |
Single | scale | scale |
Int32 | seed | seed |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
RandomUniform(TensorShape, Single, Single, Int32)
Uniform random distribution
Declaration
public virtual Tensor RandomUniform(TensorShape s, float mean, float scale, int seed)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | s | shape |
Single | mean | mean |
Single | scale | scale |
Int32 | seed | seed |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Reciprocal(Tensor)
Reciprocal (1/x)
Declaration
public virtual Tensor Reciprocal(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ReduceMax(Tensor, Int32)
Reduce with max
Declaration
public virtual Tensor ReduceMax(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ReduceMean(Tensor, Int32)
Reduce with mean
Declaration
public virtual Tensor ReduceMean(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ReduceMin(Tensor, Int32)
Reduce with min
Declaration
public virtual Tensor ReduceMin(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ReduceProd(Tensor, Int32)
Reduce with product
Declaration
public virtual Tensor ReduceProd(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ReduceSum(Tensor, Int32)
Reduce with sum
Declaration
public virtual Tensor ReduceSum(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Relu(Tensor)
ReLU
Declaration
public virtual Tensor Relu(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Relu6(Tensor)
ReLU capped to 6
Declaration
public virtual Tensor Relu6(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Resample2D(Tensor, Int32[], Boolean)
Resample 2D
Declaration
public virtual Tensor Resample2D(Tensor X, int[] size, bool bilinear)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | size | size |
Boolean | bilinear | bilinear flag |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ResetAllocator(Boolean)
Reset internal allocator
Declaration
public virtual void ResetAllocator(bool keepCachedMemory = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | keepCachedMemory | keep cached memory flag |
Implements
Reshape(Tensor, TensorShape)
Reshape
Declaration
public virtual Tensor Reshape(Tensor X, TensorShape newShape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
TensorShape | newShape |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
RoiAlign(Tensor, Tensor, Tensor, Int32, Int32, Int32, Single)
RoiAlign
Declaration
public virtual Tensor RoiAlign(Tensor X, Tensor Rois, Tensor Indices, int outputHeight, int outputWidth, int samplingRatio, float spatialScale)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | Rois | |
Tensor | Indices | |
Int32 | outputHeight | outputHeight |
Int32 | outputWidth | outputWidth |
Int32 | samplingRatio | samplingRatio |
Single | spatialScale | spatialScale |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Round(Tensor)
Round to nearest integer. In case of halfs, round to nearest even integer
Declaration
public virtual Tensor Round(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ScaleBias(Tensor, Tensor, Tensor)
Scale bias o = s * x + b, element wise
Declaration
public virtual Tensor ScaleBias(Tensor X, Tensor S, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
ScatterND(Tensor, Tensor, Tensor, Layer.ScatterNDReductionMode)
Declaration
public virtual Tensor ScatterND(Tensor X, Tensor indices, Tensor updates, Layer.ScatterNDReductionMode reduction)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | indices | |
Tensor | updates | |
Layer.ScatterNDReductionMode | reduction |
Returns
Type | Description |
---|---|
Tensor |
Implements
Selu(Tensor, Single, Single)
SELU
Declaration
public virtual Tensor Selu(Tensor X, float alpha, float gamma)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Single | gamma | gamma |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
SetModelExecutionsReporter(IModelExecutionsReporter)
Set model executions reporter model executions reporter
Declaration
public void SetModelExecutionsReporter(IModelExecutionsReporter executionsReporter)
Parameters
Type | Name | Description |
---|---|---|
IModelExecutionsReporter | executionsReporter |
Implements
Shape(Tensor, Int32)
Shape of the input
Declaration
public Tensor Shape(Tensor X, int axis = -1)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Sigmoid(Tensor)
Sigmoid
Declaration
public virtual Tensor Sigmoid(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Sign(Tensor)
Sign
Declaration
public virtual Tensor Sign(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor with 1 if x > 0 -1 if < 0 and 0 if == 0 values |
Implements
Sin(Tensor)
Sin
Declaration
public virtual Tensor Sin(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Sinh(Tensor)
Sinh
Declaration
public virtual Tensor Sinh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Softmax(Tensor, Int32)
Softmax
Declaration
public virtual Tensor Softmax(Tensor X, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Softplus(Tensor)
Softplus
Declaration
public virtual Tensor Softplus(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
SpaceToDepth(Tensor, Int32[])
Space to depth
Declaration
public virtual Tensor SpaceToDepth(Tensor X, int[] blocksize)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | blocksize |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Sqrt(Tensor)
Sqrt
Declaration
public virtual Tensor Sqrt(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
StridedSlice(Tensor, Int32[], Int32[], Int32[])
Strided slice
Declaration
public virtual Tensor StridedSlice(Tensor X, int[] starts4Dor8D, int[] ends4Dor8D, int[] strides4Dor8D)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | starts4Dor8D | |
Int32[] | ends4Dor8D | |
Int32[] | strides4Dor8D | stride |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Sub(Tensor[])
Subtract tensors o = tensors[0] - tensors[1] - ... - tensors[N-1]
Declaration
public virtual Tensor Sub(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Swish(Tensor)
Swish
Declaration
public virtual Tensor Swish(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Tan(Tensor)
Tan
Declaration
public virtual Tensor Tan(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Tanh(Tensor)
Tanh
Declaration
public virtual Tensor Tanh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Tile(Tensor, Int32[])
Tile
Declaration
public virtual Tensor Tile(Tensor X, int[] repeats)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | repeats | repetition counts |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
TopKIndices(Tensor, Int32, Int32, Boolean, Boolean)
Top K indices
Declaration
public virtual Tensor TopKIndices(Tensor X, int k, int axis, bool largest, bool sorted)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32 | k | k |
Int32 | axis | axis |
Boolean | largest | largest flag |
Boolean | sorted | sorted flag |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
TopKValues(Tensor, Tensor, Int32)
Top K values
Declaration
public virtual Tensor TopKValues(Tensor X, Tensor I, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
Tensor | I | indices |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Transpose(Tensor)
Transpose matrix
Declaration
public virtual Tensor Transpose(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Transpose(Tensor, Int32[])
Transpose according to permutations
Declaration
public virtual Tensor Transpose(Tensor X, int[] permutations)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | permutations | new axis order |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Upsample2D(Tensor, Int32[], Boolean)
Upsample 2D
Declaration
public virtual Tensor Upsample2D(Tensor X, int[] scale, bool bilinear)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | scale | scale |
Boolean | bilinear | bilinear flag |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Upsample3D(Tensor, Int32[], Boolean)
Upsample 3D
Declaration
public virtual Tensor Upsample3D(Tensor X, int[] scale, bool trilinear)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | scale | scale |
Boolean | trilinear | trilinear flag |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Implements
Where(Tensor, Tensor, Tensor)
Where
Declaration
public virtual Tensor Where(Tensor C, Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | C | |
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with values |