Class ModelBuilder | Barracuda | 1.1.2-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class ModelBuilder

    Inheritance
    Object
    ModelBuilder
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Barracuda
    Syntax
    public class ModelBuilder

    Constructors

    ModelBuilder(Model)

    Create a model builder helper to construct the underlying Model.

    Declaration
    public ModelBuilder(Model model = null)
    Parameters
    Type Name Description
    Model model

    Properties

    model

    Declaration
    public Model model { get; }
    Property Value
    Type Description
    Model

    Methods

    Abs(String, Object)

    Element-wise function that calculates absolute values of the input: f(x) = abs(x)

    Declaration
    public Layer Abs(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Acos(String, Object)

    Element-wise Acos activation function: f(x) = acos(x)

    Declaration
    public Layer Acos(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Acosh(String, Object)

    Element-wise Acosh activation function: f(x) = acosh(x)

    Declaration
    public Layer Acosh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Add(String, Object[])

    Element-wise add of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Add(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Asin(String, Object)

    Element-wise Asin activation function: f(x) = asin(x)

    Declaration
    public Layer Asin(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Asinh(String, Object)

    Element-wise Asinh activation function: f(x) = asinh(x)

    Declaration
    public Layer Asinh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Atan(String, Object)

    Element-wise Atan activation function: f(x) = atan(x)

    Declaration
    public Layer Atan(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Atanh(String, Object)

    Element-wise Atanh activation function: f(x) = atanh(x)

    Declaration
    public Layer Atanh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    AvgPool2D(String, Object, Int32[], Int32[], Int32[])

    Apply 'average' pooling by downscaling H and W dimension according to pool, stride and pad. Pool and stride should be of size 2 and format is [W, H]. Pad should be of size 4 and format is [pre W, pre H, post W, post H].

    Output batch and channels dimensions the same as input. output.shape[H,W] = (input.shape[H,W] + pad[1,0] + pad[3,2] - pool[1,0]) / stride[1,0] + 1.

    Declaration
    public Layer AvgPool2D(string name, object input, int[] pool, int[] stride, int[] pad)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pool
    Int32[] stride
    Int32[] pad
    Returns
    Type Description
    Layer

    Border2D(String, Object, Int32[], Single)

    Pads H and W dimension with a given constant value (default to 0). Pad should be of size 4 and format is [pre W, pre H, post W, post H]. If pad contain negative values H and W dimensions will be cropped instead.

    For example a tensor of shape(1,2,3,1) [1, 2, 3], [4, 5, 6]

    With pad [2, 1, 2, 1]

    Result in a tensor of shape(1,4,7,1) [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 2, 3, 0, 0], [0, 0, 4, 5, 6, 0, 0], [0, 0, 0, 0, 0, 0, 0]

    Declaration
    public Layer Border2D(string name, object input, int[] pad, float constantValue = 0F)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pad
    Single constantValue
    Returns
    Type Description
    Layer

    Ceil(String, Object)

    Element-wise function that produces rounding towards the greatest integer less than or equal to the input value: f(x) = ceil(x)

    Declaration
    public Layer Ceil(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Clip(String, Object, Single, Single)

    Declaration
    public Layer Clip(string name, object input, float min, float max)
    Parameters
    Type Name Description
    String name
    Object input
    Single min
    Single max
    Returns
    Type Description
    Layer

    Concat(String, Object[], Int32, Boolean)

    Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the axis to concatenate on. If axisIs8D==true axis rank is from [S,R,N,T,D,H,W,C] overwise from [N,H,W,C] axis must be superior to -4 axis must be inferior to 8 when axisIs8D==true or inferior to 4 if axisIs8D==false

    Declaration
    public Layer Concat(string name, object[] inputs, int axis = -1, bool axisIs8D = false)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Int32 axis
    Boolean axisIs8D
    Returns
    Type Description
    Layer

    Const(String, Tensor, Int32)

    Allow to load a tensor from constants.

    Declaration
    public Layer Const(string name, Tensor tensor, int insertionIndex = -1)
    Parameters
    Type Name Description
    String name
    Tensor tensor
    Int32 insertionIndex
    Returns
    Type Description
    Layer

    Conv2D(String, Object, Int32[], Int32[], Tensor, Tensor)

    Apply a spatial 2D convolution on H and W. Stride should be of size 2 and format is [W, H]. Pad should be of size 4 and format is [pre W, pre H, post W, post H]. Kernel should be a tensor of shape [kernelHeight, kernelWidth, kernelDepth, kernelCount] Bias should be a tensor with (batch == 1) and (height * width * channels == kernelCount)

    Output batch is same as input. Output channel is kernel.shape[3]. output.shape[H,W] = (input.shape[H,W] + pad[1,0] + pad[3,2] - kernel.shape[1,0]) / stride[1,0] + 1.

    Declaration
    public Layer Conv2D(string name, object input, int[] stride, int[] pad, Tensor kernel, Tensor bias)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] stride
    Int32[] pad
    Tensor kernel
    Tensor bias
    Returns
    Type Description
    Layer

    Conv2DTrans(String, Object, Int32[], Int32[], Int32[], Tensor, Tensor)

    Apply a spatial 2D transposed convolution on H and W. Stride should be of size 2 and format is [W, H]. Pad should be of size 4 and format is [pre W, pre H, post W, post H]. Kernel should be a tensor of rank 4 of dimensions [kernelHeight, kernelWidth, kernelDepth, kernelCount] Bias should be a tensor with (batch == 1) and (height * width * channels == kernelCount) OutputPad should be of length 0 or 2, format is [W, H]. If OutputPad length is 0 it will be defaulted to: OutputPad[W,H] = (input.shape[W,H] * stride[0,1] + pad[0,1] + pad[2,3] - [kernelWidth, kernelHeight]) % stride[0,1]

    Output batch is same as input. Output channel is kernel.shape[3]. output.shape[H,W] = (input.shape[H,W]-1) * stride[0,1] - (pad[1,0] + pad[3,2]) + [kernelWidth, kernelHeight] + OutputPad[W,H]

    Declaration
    public Layer Conv2DTrans(string name, object input, int[] stride, int[] pad, int[] outputPad, Tensor kernel, Tensor bias)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] stride
    Int32[] pad
    Int32[] outputPad
    Tensor kernel
    Tensor bias
    Returns
    Type Description
    Layer

    Copy(String, Object)

    Make a shallow copy of the input tensor.

    Declaration
    public Layer Copy(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Cos(String, Object)

    Element-wise Cos activation function: f(x) = cos(x)

    Declaration
    public Layer Cos(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Cosh(String, Object)

    Element-wise Cosh activation function: f(x) = cosh(x)

    Declaration
    public Layer Cosh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Dense(String, Object, Tensor, Tensor)

    Apply a densely connected layer (aka general matrix multiplication or GEMM) Bias should be a tensor with (batch == input.shape[H] * input.shape[W] * input.shape[C]) and only one other dimensions of size > 1 Weight should be a tensor with (batch == 1) and (height * width * channels == bias.shape[B] * )

    Output shape is [input.shape[B], 1, 1, Weight.shape[H]Weight.shape[W]Weight.shape[C]]

    Declaration
    public Layer Dense(string name, object input, Tensor weight, Tensor bias)
    Parameters
    Type Name Description
    String name
    Object input
    Tensor weight
    Tensor bias
    Returns
    Type Description
    Layer

    DepthToSpace(String, Object, Int32, String)

    DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of the input tensor where values from the depth dimension are moved in spatial blocks to the height and width dimensions. By default, mode = DCR. In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the following order: depth, column, and then row. In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the following order: column, row, and depth.

    Declaration
    public Layer DepthToSpace(string name, object source, int blocksize, string mode)
    Parameters
    Type Name Description
    String name
    Object source
    Int32 blocksize
    String mode
    Returns
    Type Description
    Layer

    DepthwiseConv2D(String, Object, Int32[], Int32[], Tensor, Tensor)

    Apply a spatial 2D depthwise convolution on H and W. Stride should be of size 2 and format is [W, H]. Pad should be of size 4 and format is [pre W, pre H, post W, post H]. Kernel should be a tensor of shape [kernelHeight, kernelWidth, kernelDepth, kernelCount] Thus input must have a channel dimension of 1 Bias should be a tensor with (batch == 1) and (height * width * channels == kernelCount)

    Output batch is same as input. Output channel is kernel.shape[3]. output.shape[H,W] = (input.shape[H,W] + pad[1,0] + pad[3,2] - kernel.shape[1,0]) / stride[1,0] + 1.

    Declaration
    public Layer DepthwiseConv2D(string name, object input, int[] stride, int[] pad, Tensor kernel, Tensor bias)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] stride
    Int32[] pad
    Tensor kernel
    Tensor bias
    Returns
    Type Description
    Layer

    Div(String, Object[])

    Element-wise division of each of the input tensors with multidimensional broadcasting support. First element is divided by the 2nd, then result is divided by the third one and so on.

    Declaration
    public Layer Div(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Elu(String, Object, Single)

    Element-wise Elu activation function: f(x) = x if x >= 0 else alpha*(e^x - 1) alpha default is 1.0

    Declaration
    public Layer Elu(string name, object input, float alpha = 1F)
    Parameters
    Type Name Description
    String name
    Object input
    Single alpha
    Returns
    Type Description
    Layer

    Equal(String, Object, Object)

    Performs a equal logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise.

    Declaration
    public Layer Equal(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    Exp(String, Object)

    Element-wise Exp function that calculates exponential of the input: f(x) = e^{x}

    Declaration
    public Layer Exp(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Expand(String, Object, Int32[])

    Broadcast the input tensor following the given shape and similar to numpy.array(input) * numpy.ones(shape). Two corresponding dimension must have the same value, or the input dimension is 1.

    Declaration
    public Layer Expand(string name, object input, int[] shape)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] shape
    Returns
    Type Description
    Layer

    Flatten(String, Object)

    From a Tensor of shape [S,R,N,T,D,H,W,C] return a tensor of shape [S,R,N,1,1,1,1,TDHWC]

    Declaration
    public Layer Flatten(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Floor(String, Object)

    Element-wise function that produces rounding towards least integer greater than or equal to the input value: f(x) = floor(x)

    Declaration
    public Layer Floor(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Gather(String, Object, Object, Int32, Boolean)

    Gathers input along provided axis. Swizzling pattern is given by input indices: If axisIs8D==false axis == 0: gatheredData[b, y, x, c] = data[indices[b], y, x, c] axis == 1: gatheredData[b, y, x, c] = data[b, indices[y], x, c] ... Else axis == 0: gatheredData[s, r, n, t, d, y, x, c] = data[indices[s], r, n, t, d, y, x, c] axis == 1: gatheredData[s, r, n, t, d, y, x, c] = data[indices[s], indices[y], n, t, d, y, x, c] ... While in both case axis == -1: gatheredData[..., x, c] = data[...x, indices[c]] axis must be superior to -4 axis must be inferior to 8 when axisIs8D==true or inferior to 4 if axisIs8D==false

    Declaration
    public Layer Gather(string name, object input, object indices, int axis = -1, bool axisIs8D = false)
    Parameters
    Type Name Description
    String name
    Object input
    Object indices
    Int32 axis
    Boolean axisIs8D
    Returns
    Type Description
    Layer

    GlobalAvgPool2D(String, Object)

    Apply 'average' pooling by downscaling H and W dimension to [1,1]

    Declaration
    public Layer GlobalAvgPool2D(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    GlobalMaxPool2D(String, Object)

    Apply 'max' pooling by downscaling H and W dimension to [1,1]

    Declaration
    public Layer GlobalMaxPool2D(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Greater(String, Object, Object)

    Performs a greater logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise.

    Declaration
    public Layer Greater(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    GreaterEqual(String, Object, Object)

    Performs a greaterEqual logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise.

    Declaration
    public Layer GreaterEqual(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    Identity(String, Object)

    No-op layer

    Declaration
    public Layer Identity(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Input(String, Int32, Int32)

    Add an input to the model

    Declaration
    public Model.Input Input(string name, int batch, int channels)
    Parameters
    Type Name Description
    String name
    Int32 batch
    Int32 channels
    Returns
    Type Description
    Model.Input

    Input(String, Int32, Int32, Int32, Int32)

    Add an input to the model

    Declaration
    public Model.Input Input(string name, int batch, int height, int width, int channels)
    Parameters
    Type Name Description
    String name
    Int32 batch
    Int32 height
    Int32 width
    Int32 channels
    Returns
    Type Description
    Model.Input

    Input(String, Int32[])

    Add an input to the model

    Declaration
    public Model.Input Input(string name, int[] shape)
    Parameters
    Type Name Description
    String name
    Int32[] shape
    Returns
    Type Description
    Model.Input

    Input(String, TensorShape)

    Add an input to the model

    Declaration
    public Model.Input Input(string name, TensorShape shape)
    Parameters
    Type Name Description
    String name
    TensorShape shape
    Returns
    Type Description
    Model.Input

    LeakyRelu(String, Object, Single)

    Element-wise LeakyRelu activation function: f(x) = x if x >= 0 else alpha * x alpha default is 0.01

    Declaration
    public Layer LeakyRelu(string name, object input, float alpha = 0.01F)
    Parameters
    Type Name Description
    String name
    Object input
    Single alpha
    Returns
    Type Description
    Layer

    Less(String, Object, Object)

    Performs a less logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise.

    Declaration
    public Layer Less(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    LessEqual(String, Object, Object)

    Performs a less equal logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise.

    Declaration
    public Layer LessEqual(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    Log(String, Object)

    Element-wise Log function that calculates the natural log of the input: f(x) = log(x)

    Declaration
    public Layer Log(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    LogicalAnd(String, Object, Object)

    Performs a and logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise. Input is consider false if 0.0 elementwise true otherwise.

    Declaration
    public Layer LogicalAnd(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    LogicalNot(String, Object)

    Performs a not logical operation elementwise on the input tensor. Return 1.0 elementwise if condition is true 0.0 otherwise. Input is consider false if 0.0 elementwise true otherwise.

    Declaration
    public Layer LogicalNot(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    LogicalOr(String, Object, Object)

    Performs a or logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise. Input is consider false if 0.0 elementwise true otherwise.

    Declaration
    public Layer LogicalOr(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    LogicalXor(String, Object, Object)

    Performs a xor logical operation elementwise on the input tensors with multidimensional broadcasting support. Return 1.0 elementwise if condition is true 0.0 otherwise. Input is consider false if 0.0 elementwise true otherwise.

    Declaration
    public Layer LogicalXor(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    LogSoftmax(String, Object)

    Return the logsoftmax (normalized exponential) values of the flatten HWC dimensions of the input. Thus output will be of shape [input.Batch, input.Height * input.Width * input.Channels]

    Declaration
    public Layer LogSoftmax(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    LRN(String, Object, Single, Single, Single, Int32)

    Apply Local Response Normalization as described in the AlexNet paper https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf It normalizes over local input regions, local region being defined across channels.

    For an element X[n, h, w, c] in a tensor of shape (N x H x W x C), its region is X[n, h, w, cRange] with cRange = [max(0, c - floor((size - 1) / 2)), min(C - 1, c + ceil((size - 1) / 2)].

    y = x / Pow( bias + alpha * sum( xOverLocalRange ^ 2 ) / size, beta)

    Output shape is same as input.

    Declaration
    public Layer LRN(string name, object input, float alpha, float beta, float bias, int size)
    Parameters
    Type Name Description
    String name
    Object input
    Single alpha
    Single beta
    Single bias
    Int32 size
    Returns
    Type Description
    Layer

    MatMul(String, Object, Object)

    Applies matrix multiplication between A and B

    Declaration
    public Layer MatMul(string name, object input0, object input1)
    Parameters
    Type Name Description
    String name
    Object input0
    Object input1
    Returns
    Type Description
    Layer

    Max(String, Object[])

    Element-wise max of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Max(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    MaxPool2D(String, Object, Int32[], Int32[], Int32[])

    Apply 'max' pooling by downscaling H and W dimension according to pool, stride and pad. Pool and stride should be of size 2 and format is [W, H]. Pad should be of size 4 and format is [pre W, pre H, post W, post H].

    Output batch and channels dimensions the same as input. output.shape[H,W] = (input.shape[H,W] + pad[1,0] + pad[3,2] - pool[1,0]) / stride[1,0] + 1.

    Declaration
    public Layer MaxPool2D(string name, object input, int[] pool, int[] stride, int[] pad)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pool
    Int32[] stride
    Int32[] pad
    Returns
    Type Description
    Layer

    Mean(String, Object[])

    Element-wise mean of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Mean(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Memory(Object, Object, TensorShape)

    Add memory to the model

    Declaration
    public Model.Memory Memory(object input, object output, TensorShape shape)
    Parameters
    Type Name Description
    Object input
    Object output
    TensorShape shape
    Returns
    Type Description
    Model.Memory

    Min(String, Object[])

    Element-wise min of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Min(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Mul(String, Object[])

    Element-wise multiplication of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Mul(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Multinomial(String, Object, Int32, Single)

    Generate a Tensor with random samples drawn from a multinomial distribution according to the probabilities of each of the possible outcomes. Output batch is same as input. Output channel is numberOfSamplesDrawnPerInputChannel.

    Declaration
    public Layer Multinomial(string name, object input, int numberOfSamplesDrawnPerInputChannel, float seed)
    Parameters
    Type Name Description
    String name
    Object input
    Int32 numberOfSamplesDrawnPerInputChannel
    Single seed
    Returns
    Type Description
    Layer

    Neg(String, Object)

    Element-wise function that flips the sign of the input: f(x) = -x

    Declaration
    public Layer Neg(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Normalization(String, Object, Tensor, Tensor, Single)

    Carries out instance normalization as described in the paper https://arxiv.org/abs/1607.08022 y = scale * (x - mean) / sqrt(variance + epsilon) + bias, where mean and variance are computed per instance per channel. Scale and bias should be tensors of shape [1,1,1, input.shape[C]]

    Output shape is same as input.

    Declaration
    public Layer Normalization(string name, object input, Tensor scale, Tensor bias, float epsilon = 1E-05F)
    Parameters
    Type Name Description
    String name
    Object input
    Tensor scale
    Tensor bias
    Single epsilon
    Returns
    Type Description
    Layer

    OneHot(String, Object, Int32, Int32, Int32)

    Maps integer to one-hot vector of length equal to depth.

    Declaration
    public Layer OneHot(string name, object input, int depth, int on, int off)
    Parameters
    Type Name Description
    String name
    Object input
    Int32 depth
    Int32 on
    Int32 off
    Returns
    Type Description
    Layer

    Output(Object)

    Add an output to the model

    Declaration
    public string Output(object input)
    Parameters
    Type Name Description
    Object input
    Returns
    Type Description
    String

    Pad2DEdge(String, Object, Int32[])

    Pads H and W dimension by repeating the edge values of the input. Pad should be of size 4 and format is [pre W, pre H, post W, post H].

    For example a tensor of shape(1,2,3,1): [1, 2, 3], [4, 5, 6]

    With pad [2, 1, 2, 1]

    Result in a tensor of shape(1,4,7,1) [1, 1, 1, 2, 3, 3, 3], [1, 1, 1, 2, 3, 3, 3], [4, 4, 4, 5, 6, 6, 6], [4, 4, 4, 5, 6, 6, 6]

    Declaration
    public Layer Pad2DEdge(string name, object input, int[] pad)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pad
    Returns
    Type Description
    Layer

    Pad2DReflect(String, Object, Int32[])

    Pads H and W dimension by mirroring on the first and last values along those axis. Pad should be of size 4 and format is [pre W, pre H, post W, post H].

    For example a tensor of shape(1,2,3,1): [1, 2, 3], [4, 5, 6]

    With pad [2, 1, 2, 1]

    Result in a tensor of shape(1,4,7,1) [6, 5, 4, 5, 6, 5, 4], [3, 2, 1, 2, 3, 2, 1], [6, 5, 4, 5, 6, 5, 4], [3, 2, 1, 2, 3, 2, 1]

    Declaration
    public Layer Pad2DReflect(string name, object input, int[] pad)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pad
    Returns
    Type Description
    Layer

    Pad2Symmetric(String, Object, Int32[])

    Pads H and W dimension with symmetric replication along those axis. Pad should be of size 4 and format is [pre W, pre H, post W, post H].

    For example a tensor of shape(1,2,3,1): [1, 2, 3], [4, 5, 6]

    With pad [2, 1, 2, 1]

    Result in a tensor of shape(1,4,7,1) [2, 1, 1, 2, 3, 3, 2], [2, 1, 1, 2, 3, 3, 2], [5, 4, 4, 5, 6, 6, 5], [5, 4, 4, 5, 6, 6, 5]

    Declaration
    public Layer Pad2Symmetric(string name, object input, int[] pad)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] pad
    Returns
    Type Description
    Layer

    Pow(String, Object[])

    Element-wise pow of each of the input tensors with multidimensional broadcasting support. First element get raised to the pow of the 2nd, then result is raised to the pow of the third one and so on.

    Declaration
    public Layer Pow(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    PRelu(String, Object, Object)

    Element-wise PRelu activation function: f(x) = x if x >= 0 else slope * x

    Declaration
    public Layer PRelu(string name, object input, object slope)
    Parameters
    Type Name Description
    String name
    Object input
    Object slope
    Returns
    Type Description
    Layer

    RandomNormal(String, Object, Single, Single, Single)

    Generates a Tensor with random values drawn from a normal distribution. The shape of the tensor is specified by input tensor The normal distribution is specified by mean and scale

    Declaration
    public Layer RandomNormal(string name, object input, float mean, float scale, float seed)
    Parameters
    Type Name Description
    String name
    Object input
    Single mean
    Single scale
    Single seed
    Returns
    Type Description
    Layer

    RandomNormal(String, TensorShape, Single, Single, Single)

    Generates a Tensor with random values drawn from a normal distribution. The shape of the tensor is specified by scale The normal distribution is specified by mean and scale

    Declaration
    public Layer RandomNormal(string name, TensorShape shape, float mean, float scale, float seed)
    Parameters
    Type Name Description
    String name
    TensorShape shape
    Single mean
    Single scale
    Single seed
    Returns
    Type Description
    Layer

    RandomUniform(String, Object, Single, Single, Single)

    Generates a Tensor with random values drawn from a uniform distribution. The shape of the tensor is specified by input tensor The uniform distribution scale is specified by min and max range

    Declaration
    public Layer RandomUniform(string name, object input, float min, float max, float seed)
    Parameters
    Type Name Description
    String name
    Object input
    Single min
    Single max
    Single seed
    Returns
    Type Description
    Layer

    RandomUniform(String, TensorShape, Single, Single, Single)

    Generates a Tensor with random values drawn from a uniform distribution. The shape of the tensor is specified by shape The uniform distribution scale is specified by min and max range

    Declaration
    public Layer RandomUniform(string name, TensorShape shape, float min, float max, float seed)
    Parameters
    Type Name Description
    String name
    TensorShape shape
    Single min
    Single max
    Single seed
    Returns
    Type Description
    Layer

    Reciprocal(String, Object)

    Element-wise function that calculates reciprocal of the input: f(x) = 1/x

    Declaration
    public Layer Reciprocal(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Reduce(Layer.Type, String, Object, Int32, Boolean)

    Computes a reduce operation (max/min/mean/prod/sum) of the input tensor's element along the provided axis If axisIs8D==true axis rank is from [S,R,N,T,D,H,W,C] overwise from [N,H,W,C] axis must be superior to -4 axis must be inferior to 8 when axisIs8D==true or inferior to 4 if axisIs8D==false

    Declaration
    public Layer Reduce(Layer.Type type, string name, object input, int axis = -1, bool axisIs8D = false)
    Parameters
    Type Name Description
    Layer.Type type
    String name
    Object input
    Int32 axis
    Boolean axisIs8D
    Returns
    Type Description
    Layer

    Relu(String, Object)

    Element-wise Relu activation function: f(x) = max(0, x)

    Declaration
    public Layer Relu(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Relu6(String, Object)

    Element-wise Relu6 activation function. f(x) = min(max(x, 0), 6) see http://www.cs.utoronto.ca/~kriz/conv-cifar10-aug2010.pdf

    Declaration
    public Layer Relu6(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Resample2D(String, Object, Int32[], Boolean)

    Resample2D scales the input tensor to the given resolution. bilinear allows to choose between nearest neighbour or bilinear sampling.

    Declaration
    public Layer Resample2D(string name, object input, int[] size, bool bilinear)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] size
    Boolean bilinear
    Returns
    Type Description
    Layer

    Reshape(String, Object, Int32[])

    Apply symbolic shape to input tensor. Symbolic shape can have up to one dimension specified as unknown (value -1).

    Declaration
    public Layer Reshape(string name, object input, int[] shape)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] shape
    Returns
    Type Description
    Layer

    Reshape(String, Object, Object)

    Return a tensor of the shape like another tensor. Both tensors have to have the same number of elements.

    Declaration
    public Layer Reshape(string name, object input, object shapeLike)
    Parameters
    Type Name Description
    String name
    Object input
    Object shapeLike
    Returns
    Type Description
    Layer

    Reshape(String, Object, TensorShape)

    Apply shape to the input tensor. Number of elements in the shape must match number of elements in input tensor.

    Declaration
    public Layer Reshape(string name, object input, TensorShape shape)
    Parameters
    Type Name Description
    String name
    Object input
    TensorShape shape
    Returns
    Type Description
    Layer

    Round(String, Object)

    Element-wise function that produces rounding of the input value: f(x) = round(x)

    Declaration
    public Layer Round(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    ScaleBias(String, Object, Tensor, Tensor)

    Apply per channel scale and bias. Scale and bias should be tensors of shape [1,1,1, input.shape[C]]

    Output shape is same as input.

    Declaration
    public Layer ScaleBias(string name, object input, Tensor scale, Tensor bias)
    Parameters
    Type Name Description
    String name
    Object input
    Tensor scale
    Tensor bias
    Returns
    Type Description
    Layer

    Selu(String, Object, Single, Single)

    Element-wise Selu activation function: f(x) = gamma * x if x >= 0 else (alpha * e^x - alpha) alpha default is 1.67326 gamma default is 1.0507

    Declaration
    public Layer Selu(string name, object input, float alpha = 1.67326F, float gamma = 1.0507F)
    Parameters
    Type Name Description
    String name
    Object input
    Single alpha
    Single gamma
    Returns
    Type Description
    Layer

    Sigmoid(String, Object)

    Element-wise Sigmoid activation function: f(x) = 1/(1 + e^{-x})

    Declaration
    public Layer Sigmoid(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Sin(String, Object)

    Element-wise Sin activation function: f(x) = sin(x)

    Declaration
    public Layer Sin(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Sinh(String, Object)

    Element-wise Sinh activation function: f(x) = sinh(x)

    Declaration
    public Layer Sinh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Softmax(String, Object)

    Return the softmax (normalized exponential) values of the flatten HWC dimensions of the input. Thus output will be of shape [input.Batch, input.Height * input.Width * input.Channels]

    Declaration
    public Layer Softmax(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    SpaceToDepth(String, Object, Int32)

    SpaceToDepth rearranges blocks of [blocksize, blocksize] spatial data into depth.

    Declaration
    public Layer SpaceToDepth(string name, object source, int blocksize)
    Parameters
    Type Name Description
    String name
    Object source
    Int32 blocksize
    Returns
    Type Description
    Layer

    Sqrt(String, Object)

    Element-wise Sqrt activation function

    Declaration
    public Layer Sqrt(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    StridedSlice(String, Object, Int32[], Int32[], Int32[])

    Produces a slice of the input tensor along all axes. The following rules apply: begin=0, end=0, stride=1: copy the full range of elements from the given axis begin=A, end=B, stride=1: copy the range [A, B) (excluding the Bth element) from the given axis begin=A, end=B, stride=I: copy every Ith element in the range [A, B) from the given axis begin=N, end=N, stride=0: shrink axis to a single Nth element output.shape[] = (ends[] - starts[]) / max(1, stride[])

    Declaration
    public Layer StridedSlice(string name, object input, int[] starts, int[] ends, int[] strides)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] starts
    Int32[] ends
    Int32[] strides
    Returns
    Type Description
    Layer

    Sub(String, Object[])

    Element-wise sub of each of the input tensors with multidimensional broadcasting support.

    Declaration
    public Layer Sub(string name, object[] inputs)
    Parameters
    Type Name Description
    String name
    Object[] inputs
    Returns
    Type Description
    Layer

    Swish(String, Object)

    Element-wise Swish activation function. f(x) = sigmoid(x) * x = x/(1 + e^{-x}) see https://arxiv.org/abs/1710.05941

    Declaration
    public Layer Swish(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Tan(String, Object)

    Element-wise Tan activation function: f(x) = tan(x)

    Declaration
    public Layer Tan(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    Tanh(String, Object)

    Element-wise Tanh activation function: f(x) = (1 - e^{-2x})/(1 + e^{-2x})

    Declaration
    public Layer Tanh(string name, object input)
    Parameters
    Type Name Description
    String name
    Object input
    Returns
    Type Description
    Layer

    TopKIndices(String, Object, Object, Int32, Boolean, Boolean)

    Retrieve the indices for top-K largest or smallest elements along a specified axis.

    Declaration
    public Layer TopKIndices(string name, object input, object k, int axis, bool largest, bool sorted)
    Parameters
    Type Name Description
    String name
    Object input
    Object k
    Int32 axis
    Boolean largest
    Boolean sorted
    Returns
    Type Description
    Layer

    TopKValues(String, Object, Object, Int32)

    Given the indices for top-K largest or smallest elements along a specified axis, return the values

    Declaration
    public Layer TopKValues(string name, object input, object indices, int axis)
    Parameters
    Type Name Description
    String name
    Object input
    Object indices
    Int32 axis
    Returns
    Type Description
    Layer

    Transpose(String, Object, Int32[])

    Transpose

    Declaration
    public Layer Transpose(string name, object input, int[] permutations)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] permutations
    Returns
    Type Description
    Layer

    Upsample2D(String, Object, Int32[], Boolean)

    Upsample the input tensor by scaling H and W by upsample[0] and upsample[1] respectively. bilinear allow to choose betwen nearest neighbor or bilinear upsampling.

    Declaration
    public Layer Upsample2D(string name, object input, int[] upsample, bool bilinear)
    Parameters
    Type Name Description
    String name
    Object input
    Int32[] upsample
    Boolean bilinear
    Returns
    Type Description
    Layer

    Upsample2D(String, Object, Object, Boolean)

    Declaration
    public Layer Upsample2D(string name, object source, object scale, bool bilinear)
    Parameters
    Type Name Description
    String name
    Object source
    Object scale
    Boolean bilinear
    Returns
    Type Description
    Layer
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 15 October 2020