Class UnsafeArrayCPUOps
Unsafe array based IOps
implementation
Inherited Members
Namespace: Unity.Barracuda
Syntax
public class UnsafeArrayCPUOps : ReferenceCPUOps, IOps
Constructors
UnsafeArrayCPUOps(ITensorAllocator)
Create UnsafeArrayCPUOps
Declaration
public UnsafeArrayCPUOps(ITensorAllocator allocator = null)
Parameters
Type | Name | Description |
---|---|---|
ITensorAllocator | allocator | allocator |
Methods
Acos(Tensor)
Acos
Declaration
public override Tensor Acos(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Acosh(Tensor)
Acosh
Declaration
public override Tensor Acosh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Add(Tensor[])
Add tensors
together
Declaration
public override Tensor Add(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
ApplyFusedActivation(Tensor, Layer.FusedActivation)
Apply fused activation
Declaration
protected Tensor ApplyFusedActivation(Tensor X, Layer.FusedActivation fusedActivation)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output |
Asin(Tensor)
Asin
Declaration
public override Tensor Asin(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Asinh(Tensor)
Asinh
Declaration
public override Tensor Asinh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Atan(Tensor)
Atan
Declaration
public override Tensor Atan(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Atanh(Tensor)
Atanh
Declaration
public override Tensor Atanh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
AvgPool2D(Tensor, Int32[], Int32[], Int32[])
2D average pooling
Declaration
public override 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 |
Overrides
Border2D(Tensor, Int32[], Single)
2D border padding
Declaration
public override Tensor Border2D(Tensor X, int[] pad, float constant)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Single | constant |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Conv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)
2D convolution
Declaration
public override 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 |
Overrides
CopyAndReshape(Tensor, TensorShape)
Copy and reshape Tensor
Declaration
protected override Tensor CopyAndReshape(Tensor X, TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | input |
TensorShape | shape | shape |
Returns
Type | Description |
---|---|
Tensor | output |
Overrides
Cos(Tensor)
Cos
Declaration
public override Tensor Cos(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Cosh(Tensor)
Cosh
Declaration
public override Tensor Cosh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Dense(Tensor, Tensor, Tensor, Layer.FusedActivation)
Dense layer (matrix multiplication) o = x
⨯ w
+ b
Declaration
public override 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 |
Overrides
DepthwiseConv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)
Depthwise 2D convolution
Declaration
public override 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 |
Overrides
Div(Tensor[])
Divide tensors o = tensors[0] / tensors[1] / ... / tensors[N-1]
Declaration
public override Tensor Div(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Elu(Tensor, Single)
ELU
Declaration
public override Tensor Elu(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Equal(Tensor, Tensor)
Equal
Declaration
public override Tensor Equal(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
Exp(Tensor)
Exponent e^x
Declaration
public override Tensor Exp(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
GlobalAvgPool2D(Tensor)
2D global average pooling
Declaration
public override Tensor GlobalAvgPool2D(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
GlobalMaxPool2D(Tensor)
2D global max pooling
Declaration
public override Tensor GlobalMaxPool2D(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Greater(Tensor, Tensor)
Greater
Declaration
public override Tensor Greater(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
GreaterEqual(Tensor, Tensor)
Greater or equal
Declaration
public override Tensor GreaterEqual(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
LeakyRelu(Tensor, Single)
Leaky ReLU
Declaration
public override Tensor LeakyRelu(Tensor X, float alpha)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Single | alpha | alpha |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Less(Tensor, Tensor)
Less
Declaration
public override Tensor Less(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
LessEqual(Tensor, Tensor)
Less or equal
Declaration
public override Tensor LessEqual(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
LogicalAnd(Tensor, Tensor)
And
Declaration
public override Tensor LogicalAnd(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
LogicalNot(Tensor)
Not
Declaration
public override Tensor LogicalNot(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor with !x values |
Overrides
LogicalOr(Tensor, Tensor)
Or
Declaration
public override Tensor LogicalOr(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
LogicalXor(Tensor, Tensor)
Xor
Declaration
public override Tensor LogicalXor(Tensor A, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | A | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | Tensor with |
Overrides
MatMul(Tensor, Boolean, Tensor, Boolean)
Simple 2D matrix multiplication O = X
⨯ Y
Declaration
public override 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 |
Overrides
Max(Tensor[])
Max
Declaration
public override Tensor Max(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
MaxPool2D(Tensor, Int32[], Int32[], Int32[])
2D max pooling
Declaration
public override 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 |
Overrides
Min(Tensor[])
Min
Declaration
public override Tensor Min(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Mul(Tensor[])
Multiply tensors together
Declaration
public override Tensor Mul(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Neg(Tensor)
Neg
Declaration
public override Tensor Neg(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pad2DEdge(Tensor, Int32[])
Edge padding
Declaration
public override Tensor Pad2DEdge(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pad2DReflect(Tensor, Int32[])
Reflection padding
Declaration
public override Tensor Pad2DReflect(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pad2DSymmetric(Tensor, Int32[])
Symmetric padding
Declaration
public override Tensor Pad2DSymmetric(Tensor X, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pin(Tensor, Boolean)
Pin specified Tensor
to unsafe array based CPU device, if uploadCache
is false, data is not uploaded to device
Declaration
public static UnsafeArrayTensorData Pin(Tensor X, bool uploadCache = true)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
|
Boolean | uploadCache |
|
Returns
Type | Description |
---|---|
UnsafeArrayTensorData |
|
PRelu(Tensor, Tensor)
PReLU
Declaration
public override Tensor PRelu(Tensor X, Tensor S)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Prepare(Tensor)
Prepares tensor for use
Declaration
public override Tensor Prepare(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor |
Overrides
PrepareNoAlloc(Tensor)
Prepares tensor for use without uploading internal data to device
Declaration
public override Tensor PrepareNoAlloc(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | Tensor |
Overrides
Relu(Tensor)
ReLU
Declaration
public override Tensor Relu(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Relu6(Tensor)
ReLU capped to 6
Declaration
public override Tensor Relu6(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
ScaleBias(Tensor, Tensor, Tensor)
Scale bias o = s * x + b, element wise
Declaration
public override Tensor ScaleBias(Tensor X, Tensor S, Tensor B)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Sigmoid(Tensor)
Sigmoid
Declaration
public override Tensor Sigmoid(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Sign(Tensor)
Sign
Declaration
public override 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 |
Overrides
Sin(Tensor)
Sin
Declaration
public override Tensor Sin(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Sinh(Tensor)
Sinh
Declaration
public override Tensor Sinh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Softplus(Tensor)
Softplus
Declaration
public override Tensor Softplus(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Sqrt(Tensor)
Sqrt
Declaration
public override Tensor Sqrt(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Sub(Tensor[])
Subtract tensors o = tensors[0] - tensors[1] - ... - tensors[N-1]
Declaration
public override Tensor Sub(Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Swish(Tensor)
Swish
Declaration
public override Tensor Swish(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Tan(Tensor)
Tan
Declaration
public override Tensor Tan(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Tanh(Tensor)
Tanh
Declaration
public override Tensor Tanh(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Where(Tensor, Tensor, Tensor)
Where
Declaration
public override 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 |