docs.unity3d.com
    Show / Hide Table of Contents

    Class ReferenceCPUOps

    Reference CPU implementation of IOps

    Inheritance
    Object
    ReferenceCPUOps
    ReferenceComputeOps
    UnsafeArrayCPUOps
    Namespace: Unity.Barracuda
    Syntax
    public class ReferenceCPUOps : object, 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
    IOps.Abs(Tensor)

    Acos(Tensor)

    Acos

    Declaration
    public virtual Tensor Acos(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Acos(Tensor)

    Acosh(Tensor)

    Acosh

    Declaration
    public virtual Tensor Acosh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Acosh(Tensor)

    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
    IOps.Add(Tensor[])

    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
    IOps.ArgMax(Tensor, Int32)

    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
    IOps.ArgMin(Tensor, Int32)

    Asin(Tensor)

    Asin

    Declaration
    public virtual Tensor Asin(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Asin(Tensor)

    Asinh(Tensor)

    Asinh

    Declaration
    public virtual Tensor Asinh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Asinh(Tensor)

    Atan(Tensor)

    Atan

    Declaration
    public virtual Tensor Atan(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Atan(Tensor)

    Atanh(Tensor)

    Atanh

    Declaration
    public virtual Tensor Atanh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Atanh(Tensor)

    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
    IOps.AvgPool2D(Tensor, Int32[], Int32[], Int32[])

    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
    IOps.Border2D(Tensor, Int32[], Single)

    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
    IOps.Border3D(Tensor, Int32[], Single)

    Ceil(Tensor)

    Ceil

    Declaration
    public virtual Tensor Ceil(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Ceil(Tensor)

    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
    IOps.Clip(Tensor, Single, Single)

    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
    IOps.Concat(Tensor[], Int32)

    ConstantOfShape(TensorShape, Single)

    Creates a constant of shape input

    Declaration
    public Tensor ConstantOfShape(TensorShape X, float value)
    Parameters
    Type Name Description
    TensorShape X

    input shape

    Single value

    value

    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.ConstantOfShape(TensorShape, Single)

    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
    IOps.Conv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)

    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
    IOps.Conv2DTrans(Tensor, Tensor, Tensor, Int32[], Int32[], Int32[], Layer.FusedActivation)

    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
    IOps.Conv3D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)

    Copy(Tensor)

    Copy

    Declaration
    public virtual Tensor Copy(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Copy(Tensor)

    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 Tensor

    Cos(Tensor)

    Cos

    Declaration
    public virtual Tensor Cos(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Cos(Tensor)

    Cosh(Tensor)

    Cosh

    Declaration
    public virtual Tensor Cosh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Cosh(Tensor)

    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
    IOps.Dense(Tensor, Tensor, Tensor, Layer.FusedActivation)

    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
    IOps.Dense3(Tensor, Tensor, Tensor)

    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
    IOps.DepthToSpace(Tensor, Int32[], Layer.DepthToSpaceMode)

    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
    IOps.DepthwiseConv2D(Tensor, Tensor, Tensor, Int32[], Int32[], Layer.FusedActivation)

    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
    IOps.Div(Tensor[])

    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
    IOps.Dropout(Tensor, Single)

    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
    IOps.Elu(Tensor, Single)

    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 true where a == b

    Implements
    IOps.Equal(Tensor, Tensor)

    Erf(Tensor)

    Erf

    Declaration
    public virtual Tensor Erf(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Erf(Tensor)

    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
    IOps.Exp(Tensor)

    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
    IOps.Expand(Tensor, TensorShape)

    Flatten(Tensor)

    Flatten

    Declaration
    public virtual Tensor Flatten(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Flatten(Tensor)

    Floor(Tensor)

    Floor

    Declaration
    public virtual Tensor Floor(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Floor(Tensor)

    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
    IOps.Gather(Tensor[], Int32)

    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
    IOps.GetModelExecutionsReporter()

    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
    IOps.GlobalAvgPool2D(Tensor)

    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
    IOps.GlobalAvgVariancePool2D(Tensor)

    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
    IOps.GlobalMaxPool2D(Tensor)

    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 true where a > b

    Implements
    IOps.Greater(Tensor, Tensor)

    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 true where a >= b

    Implements
    IOps.GreaterEqual(Tensor, Tensor)

    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
    IOps.HardSigmoid(Tensor, Single, Single)

    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
    IOps.LeakyRelu(Tensor, Single)

    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 true where a < b

    Implements
    IOps.Less(Tensor, Tensor)

    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 true where a < b

    Implements
    IOps.LessEqual(Tensor, Tensor)

    Log(Tensor)

    Log

    Declaration
    public virtual Tensor Log(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Log(Tensor)

    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 true where a && b

    Implements
    IOps.LogicalAnd(Tensor, Tensor)

    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
    IOps.LogicalNot(Tensor)

    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 true where a || b

    Implements
    IOps.LogicalOr(Tensor, Tensor)

    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 true where a xor b

    Implements
    IOps.LogicalXor(Tensor, Tensor)

    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
    IOps.LogSoftmax(Tensor, Int32)

    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
    IOps.LRN(Tensor, Single, Single, Single, Int32)

    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
    IOps.LSTM(Tensor, Tensor[], Tensor[], Tensor[], Tensor[], Tensor, Tensor)

    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

    X transposed data flag

    Tensor Y

    right Tensor

    Boolean yTranspose

    Y transposed data flag

    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.MatMul(Tensor, Boolean, Tensor, Boolean)

    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 x

    Tensor Y
    Int32 rankY

    rank of y

    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.MatMul(Tensor, Int32, Tensor, Int32)

    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
    IOps.Max(Tensor[])

    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
    IOps.MaxPool2D(Tensor, Int32[], Int32[], Int32[])

    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
    IOps.Mean(Tensor[])

    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
    IOps.Min(Tensor[])

    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
    IOps.Mul(Tensor[])

    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
    IOps.Multinomial(Tensor, Int32, Int32)

    Neg(Tensor)

    Neg

    Declaration
    public virtual Tensor Neg(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Neg(Tensor)

    NewTensor(Int32, Int32, Int32, Int32, AllocScope, String)

    Allocate new Tensor via allocator

    Declaration
    protected Tensor NewTensor(int b, int h, int w, int ch, AllocScope scope = AllocScope.LayerOutput, string name = "")
    Parameters
    Type Name Description
    Int32 b

    batch

    Int32 h

    height

    Int32 w

    width

    Int32 ch

    channels

    AllocScope scope

    tensor lifetime scope

    String name

    name

    Returns
    Type Description
    Tensor

    new Tensor

    NewTensor(Int32, Int32, AllocScope, String)

    Allocate new Tensor via allocator

    Declaration
    protected Tensor NewTensor(int b, int ch, AllocScope scope = AllocScope.LayerOutput, string name = "")
    Parameters
    Type Name Description
    Int32 b

    batch

    Int32 ch

    channels

    AllocScope scope

    tensor lifetime scope

    String name

    name

    Returns
    Type Description
    Tensor

    new Tensor

    NewTensor(TensorShape, AllocScope, String)

    Allocate new Tensor via allocator

    Declaration
    protected Tensor NewTensor(TensorShape s, AllocScope scope = AllocScope.LayerOutput, string name = "")
    Parameters
    Type Name Description
    TensorShape s

    shape

    AllocScope scope

    tensor lifetime scope

    String name

    name

    Returns
    Type Description
    Tensor

    new Tensor

    NewTensorLike(Tensor, AllocScope)

    Allocate new Tensor similar to specified Tensor t

    Declaration
    protected Tensor NewTensorLike(Tensor t, AllocScope scope = AllocScope.LayerOutput)
    Parameters
    Type Name Description
    Tensor t

    Tensor

    AllocScope scope

    tensor lifetime scope

    Returns
    Type Description
    Tensor

    new Tensor

    NewTensorLike(Tensor[], AllocScope)

    Allocate new Tensor corresponding to max shape of specified tensors

    Declaration
    protected Tensor NewTensorLike(Tensor[] tensors, AllocScope scope = AllocScope.LayerOutput)
    Parameters
    Type Name Description
    Tensor[] tensors

    tensors

    AllocScope scope

    tensor lifetime scope

    Returns
    Type Description
    Tensor

    new Tensor

    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
    IOps.NonMaxSuppression(Tensor[], Int32, Single, Single, Int32)

    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
    IOps.NonZero(Tensor)

    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
    IOps.Normalization(Tensor, Tensor, Tensor, Int32, Int32, Single, Layer.FusedActivation)

    OneHot(Tensor, Int32, Single, Single)

    One hot

    Declaration
    public virtual Tensor OneHot(Tensor X, int depth, float onValue, float offValue)
    Parameters
    Type Name Description
    Tensor X
    Int32 depth

    output depth

    Single onValue

    on value

    Single offValue

    off value

    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.OneHot(Tensor, Int32, Single, Single)

    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
    IOps.Pad2DEdge(Tensor, Int32[])

    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
    IOps.Pad2DReflect(Tensor, Int32[])

    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
    IOps.Pad2DSymmetric(Tensor, Int32[])

    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
    IOps.PostLayerCleanup()

    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
    IOps.Pow(Tensor, Single)

    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
    IOps.Pow(Tensor[])

    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
    IOps.PRelu(Tensor, Tensor)

    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
    IOps.Prepare(Tensor)

    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
    IOps.PrepareNoAlloc(Tensor)

    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
    IOps.RandomNormal(TensorShape, Single, Single, Int32)

    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
    IOps.RandomUniform(TensorShape, Single, Single, Int32)

    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
    IOps.Reciprocal(Tensor)

    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
    IOps.ReduceMax(Tensor, Int32)

    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
    IOps.ReduceMean(Tensor, Int32)

    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
    IOps.ReduceMin(Tensor, Int32)

    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
    IOps.ReduceProd(Tensor, Int32)

    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
    IOps.ReduceSum(Tensor, Int32)

    Relu(Tensor)

    ReLU

    Declaration
    public virtual Tensor Relu(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Relu(Tensor)

    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
    IOps.Relu6(Tensor)

    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
    IOps.Resample2D(Tensor, Int32[], Boolean)

    ResetAllocator(Boolean)

    Reset internal allocator

    Declaration
    public virtual void ResetAllocator(bool keepCachedMemory = true)
    Parameters
    Type Name Description
    Boolean keepCachedMemory

    keep cached memory flag

    Implements
    IOps.ResetAllocator(Boolean)

    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
    IOps.Reshape(Tensor, TensorShape)

    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
    IOps.Round(Tensor)

    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
    IOps.ScaleBias(Tensor, Tensor, Tensor)

    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
    IOps.Selu(Tensor, Single, Single)

    SetModelExecutionsReporter(IModelExecutionsReporter)

    Set model executions reporter model executions reporter

    Declaration
    public void SetModelExecutionsReporter(IModelExecutionsReporter executionsReporter)
    Parameters
    Type Name Description
    IModelExecutionsReporter executionsReporter
    Implements
    IOps.SetModelExecutionsReporter(IModelExecutionsReporter)

    Shape(Tensor, Int32)

    Shape of the input

    Declaration
    public Tensor Shape(Tensor X, int axis = null)
    Parameters
    Type Name Description
    Tensor X

    input

    Int32 axis

    axis

    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Shape(Tensor, Int32)

    Sigmoid(Tensor)

    Sigmoid

    Declaration
    public virtual Tensor Sigmoid(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Sigmoid(Tensor)

    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
    IOps.Sign(Tensor)

    Sin(Tensor)

    Sin

    Declaration
    public virtual Tensor Sin(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Sin(Tensor)

    Sinh(Tensor)

    Sinh

    Declaration
    public virtual Tensor Sinh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Sinh(Tensor)

    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
    IOps.Softmax(Tensor, Int32)

    Softplus(Tensor)

    Softplus

    Declaration
    public virtual Tensor Softplus(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Softplus(Tensor)

    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
    IOps.SpaceToDepth(Tensor, Int32[])

    Sqrt(Tensor)

    Sqrt

    Declaration
    public virtual Tensor Sqrt(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Sqrt(Tensor)

    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
    IOps.StridedSlice(Tensor, Int32[], Int32[], Int32[])

    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
    IOps.Sub(Tensor[])

    Swish(Tensor)

    Swish

    Declaration
    public virtual Tensor Swish(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Swish(Tensor)

    Tan(Tensor)

    Tan

    Declaration
    public virtual Tensor Tan(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Tan(Tensor)

    Tanh(Tensor)

    Tanh

    Declaration
    public virtual Tensor Tanh(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Tanh(Tensor)

    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
    IOps.Tile(Tensor, Int32[])

    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
    IOps.TopKIndices(Tensor, Int32, Int32, Boolean, Boolean)

    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
    IOps.TopKValues(Tensor, Tensor, Int32)

    Transpose(Tensor)

    Transpose matrix

    Declaration
    public virtual Tensor Transpose(Tensor X)
    Parameters
    Type Name Description
    Tensor X
    Returns
    Type Description
    Tensor

    output Tensor

    Implements
    IOps.Transpose(Tensor)

    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
    IOps.Transpose(Tensor, Int32[])

    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
    IOps.Upsample2D(Tensor, Int32[], Boolean)

    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
    IOps.Upsample3D(Tensor, Int32[], Boolean)

    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 c ? a : b

    Implements
    IOps.Where(Tensor, Tensor, Tensor)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023