Class PrecompiledComputeOps
Precompiled GPU compute IOps
implementation
Inherited Members
Namespace: Unity.Barracuda
Syntax
public class PrecompiledComputeOps : ComputeOps, IOps, IModelCompiler
Constructors
PrecompiledComputeOps(ITensorAllocator, Boolean)
Create PrecompiledComputeOps
Declaration
public PrecompiledComputeOps(ITensorAllocator allocator = null, bool verbose = false)
Parameters
Type | Name | Description |
---|---|---|
ITensorAllocator | allocator | allocator |
Boolean | verbose | verbose flag |
Methods
Activation(String, Tensor, Single, Single)
Generic activation function
Declaration
protected override Tensor Activation(string kernelName, Tensor X, float alpha = 0F, float beta = 0F)
Parameters
Type | Name | Description |
---|---|---|
String | kernelName | kernel name |
Tensor | X | input |
Single | alpha | alpha |
Single | beta | beta |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Concat(Tensor[], Int32)
Concatenate tensors
across axis
Declaration
public override Tensor Concat(Tensor[] tensors, int axis)
Parameters
Type | Name | Description |
---|---|---|
Tensor[] | tensors | input tensors |
Int32 | axis | axis |
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
Conv2DTrans(Tensor, Tensor, Tensor, Int32[], Int32[], Int32[], Layer.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 | |
Int32[] | stride | stride |
Int32[] | pad | padding |
Int32[] | outputAdjustment | output adjustments |
Layer.FusedActivation | fusedActivation | fused activation type |
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
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
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | W | |
Tensor | B |
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
ElementwiseWithBroadcast(String, Tensor[])
Elementwise broadcast for specified kernel
Declaration
protected override Tensor ElementwiseWithBroadcast(string kernelName, Tensor[] tensors)
Parameters
Type | Name | Description |
---|---|---|
String | kernelName | kernel name |
Tensor[] | tensors | input tensors |
Returns
Type | Description |
---|---|
Tensor | output |
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
LogSoftmax(Tensor)
LogSoftmax
Declaration
public override Tensor LogSoftmax(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Normalization(Tensor, Tensor, Tensor, Int32, Int32, Single, Layer.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 | |
Int32 | pool | pooling |
Int32 | axis | axis |
Single | epsilon | threshold |
Layer.FusedActivation | fusedActivation | fused activation type |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Pool2D(String, Tensor, Int32[], Int32[], Int32[])
Declaration
protected override Tensor Pool2D(string kernelName, Tensor X, int[] pool, int[] stride, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
String | kernelName | |
Tensor | X | |
Int32[] | pool | |
Int32[] | stride | |
Int32[] | pad |
Returns
Type | Description |
---|---|
Tensor |
Overrides
PreExecuteLayer(Layer, Tensor[])
Declaration
public virtual void PreExecuteLayer(Layer layer, Tensor[] inputs)
Parameters
Type | Name | Description |
---|---|---|
Layer | layer | |
Tensor[] | inputs |
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
PrepareModel(Model, IDictionary<String, TensorShape>)
Declaration
public virtual void PrepareModel(Model model, IDictionary<string, TensorShape> inputShapes)
Parameters
Type | Name | Description |
---|---|---|
Model | model | |
IDictionary<String, TensorShape> | inputShapes |
ResetAllocator(Boolean)
Reset internal allocator
Declaration
public override void ResetAllocator(bool keepCachedMemory = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | 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
Type | Name | Description |
---|---|---|
Tensor | X | |
Tensor | S | |
Tensor | B |
Returns
Type | Description |
---|---|
Tensor | output Tensor |
Overrides
Upsample2D(Tensor, Int32[], Boolean)
Upsample 2D
Declaration
public override 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 |