Class PrecompiledComputeOps
Precompiled GPU compute IOps
implementation
Inherited Members
Namespace: Unity.Barracuda
Assembly: solution.dll
Syntax
public class PrecompiledComputeOps : ComputeOps, IOps, IOpsStatistics
Constructors
PrecompiledComputeOps(ITensorAllocator, bool)
Create PrecompiledComputeOps
Declaration
public PrecompiledComputeOps(ITensorAllocator allocator = null, bool verbose = false)
Parameters
Type | Name | Description |
---|---|---|
ITensor |
allocator | allocator |
bool | verbose | verbose flag |
Methods
Activation(string, Tensor, float, float)
Generic activation function
Declaration
protected override Tensor Activation(string kernelName, Tensor X, float alpha = 0, float beta = 0)
Parameters
Type | Name | Description |
---|---|---|
string | kernelName | kernel name |
Tensor | X | input |
float | alpha | alpha |
float | beta | beta |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Concat(Tensor[], int)
Concatenate tensors
across axis
Declaration
public override Tensor Concat(Tensor[] tensors, int axis)
Parameters
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Conv2D(Tensor, Tensor, Tensor, int[], int[], 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 | |
int[] | stride | stride |
int[] | pad | padding |
Layer.Fused |
fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Conv2DTrans(Tensor, Tensor, Tensor, int[], int[], int[], FusedActivation)
Transpose 2D convolution
Declaration
public override 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 | |
int[] | stride | stride |
int[] | pad | padding |
int[] | outputAdjustment | output adjustments |
Layer.Fused |
fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Dense(Tensor, Tensor, Tensor, 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.Fused |
fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
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 override Tensor Dense3(Tensor X, Tensor W, Tensor B)
Parameters
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
DepthwiseConv2D(Tensor, Tensor, Tensor, int[], int[], 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 | |
int[] | stride | stride |
int[] | pad | padding |
Layer.Fused |
fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
ElementwiseWithBroadcast(string, Tensor[])
Elementwise broadcast for specified kernel
Declaration
protected override Tensor ElementwiseWithBroadcast(string kernelName, Tensor[] tensors)
Parameters
Returns
Type | Description |
---|---|
Tensor | output |
Overrides
Exceptions
Type | Condition |
---|---|
Not |
thrown if input |
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
Normalization(Tensor, Tensor, Tensor, int, int, float, FusedActivation)
Normalization
Declaration
public override 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 | |
int | pool | pooling |
int | axis | axis |
float | epsilon | threshold |
Layer.Fused |
fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
PRelu(Tensor, Tensor)
PReLU
Declaration
public override Tensor PRelu(Tensor X, Tensor S)
Parameters
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pool2D(string, Tensor, int[], int[], int[])
Declaration
protected override Tensor Pool2D(string kernelName, Tensor X, int[] pool, int[] stride, int[] pad)
Parameters
Returns
Type | Description |
---|---|
Tensor |
Overrides
PreExecuteLayer(Layer, Tensor[])
Prepare for layer execution
Declaration
public virtual void PreExecuteLayer(Layer layer, Tensor[] inputs)
Parameters
PrepareModel(Model, IDictionary<string, TensorShape>, IVars)
Prepare model for execution, allocating required intermediate tensors
Declaration
public virtual void PrepareModel(Model model, IDictionary<string, TensorShape> inputShapes, IVars vars)
Parameters
Type | Name | Description |
---|---|---|
Model | model | model |
IDictionary<string, Tensor |
inputShapes | input shapes |
IVars | vars | model variables |
ReduceHelper(Type, Tensor, int, AllocScope)
Declaration
protected override Tensor ReduceHelper(Layer.Type kernelName, Tensor X, int axis, AllocScope outputScope)
Parameters
Type | Name | Description |
---|---|---|
Layer.Type | kernelName | |
Tensor | X | |
int | axis | |
Alloc |
outputScope |
Returns
Type | Description |
---|---|
Tensor |
Overrides
ResetAllocator(bool)
Reset internal allocator
Declaration
public override void ResetAllocator(bool keepCachedMemory = true)
Parameters
Type | Name | Description |
---|---|---|
bool | keepCachedMemory | keep cached memory flag |
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
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Upsample2D(Tensor, int[], bool)
Upsample 2D
Declaration
public override Tensor Upsample2D(Tensor X, int[] scale, bool bilinear)
Parameters
Returns
Type | Description |
---|---|
Tensor | output Tensor |