Class ModelBuilder
Class responsible for run-time model building from Neural Net primitives.
Inherited Members
Namespace: Unity.Barracuda
Assembly: Unity.Barracuda.dll
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 | base model to continue building on |
Properties
model
Model under construction
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
AvgPool2D(string, object, int[], int[], int[])
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 | Layer name |
| object | input | input node |
| int[] | pool | pooling |
| int[] | stride | stride |
| int[] | pad | padding |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Border2D(string, object, int[], float)
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 = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | pad | padding |
| float | constantValue | border constant value |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Border3D(string, object, int[], float)
Pads D,H and W dimension with a given constant value (default to 0). Pad should be of size 6 and format is [pre W, pre H, pre D, post W, post H, post D]. If pad contain negative values H and W dimensions will be cropped instead.
Declaration
public Layer Border3D(string name, object input, int[] pad, float constantValue = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | pad | padding |
| float | constantValue | constant value to use for border |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Clip(string, object, float, float)
Element-wise Clip function that limits values within an interval: f(x, xmin, xmax) = min(max(x, xmin), xmax)
Declaration
public Layer Clip(string name, object input, float min, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | min | min |
| float | max | max |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Concat(string, object[], int, bool)
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 | Layer name |
| object[] | inputs | input node |
| int | axis | axis |
| bool | axisIs8D | is axis 8D |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Const(string, Tensor, int, int)
Allow to load a tensor from constants.
Declaration
public Layer Const(string name, Tensor tensor, int insertionIndex = -1, int rank = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| Tensor | tensor | data Tensor |
| int | insertionIndex | insertion index in Layer list |
| int | rank | constant rank |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
ConstantOfShape(string, object, float)
Creates a constant tensor populated with value as the same shape of input.
Declaration
public Layer ConstantOfShape(string name, object input, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | value | value |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Conv2D(string, object, int[], int[], 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.kernelCount. 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 | Layer name |
| object | input | input node |
| int[] | stride | stride |
| int[] | pad | padding |
| Tensor | kernel | kernel weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Conv2DTrans(string, object, int[], int[], int[], 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 | Layer name |
| object | input | input node |
| int[] | stride | stride |
| int[] | pad | padding |
| int[] | outputPad | output padding |
| Tensor | kernel | kernel weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Conv3D(string, object, int[], int[], Tensor, Tensor)
Apply a spatial 3D convolution on H, W and D. Stride should be of size 3 and format is [W, H, D]. Pad should be of size 6 and format is [pre W, pre H, pre D, post W, post H, post D]. Kernel should be a tensor of shape [kernelSpatialHeight, kernelSpatialWidth, kernelSpatialDepth, 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.kernelCount. output.shape[D,H,W] = (input.shape[D,H,W] + pad[2,1,0] + pad[5,4,3] - kernel.shape[2,1,0]) / stride[2,1,0] + 1.
Declaration
public Layer Conv3D(string name, object input, int[] stride, int[] pad, Tensor kernel, Tensor bias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | stride | stride |
| int[] | pad | padding |
| Tensor | kernel | kernel weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
| Tensor | weight | weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Dense3(string, object, Tensor, Tensor)
Rank 3 Dense layer
Declaration
public Layer Dense3(string name, object input, Tensor weight, Tensor bias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| Tensor | weight | weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
DepthToSpace(string, object, int, 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 | Layer name |
| object | source | input node |
| int | blocksize | block size |
| string | mode | mode, see |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
DepthwiseConv2D(string, object, int[], int[], 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 | Layer name |
| object | input | input node |
| int[] | stride | stride |
| int[] | pad | padding |
| Tensor | kernel | kernel weight data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Elu(string, object, float)
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 = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | alpha | alpha |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Erf(string, object)
Element-wise Erf activation function: f(x) = erf(x)
Declaration
public Layer Erf(string name, object input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Exp(string, object)
Element-wise Exp function that calculates exponential of the input: f(x) = e^
Declaration
public Layer Exp(string name, object input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Expand(string, object, int[])
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 | Layer name |
| object | input | input node |
| int[] | shape | shape |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Gather(string, object, object, int, bool)
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 | Layer name |
| object | input | input node |
| object | indices | indices |
| int | axis | axis |
| bool | axisIs8D | is axis 8D |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
HardSigmoid(string, object, float, float)
Element-wise HardSigmoid activation function: f(x) = maX(0, min(1, a * x + b))
Declaration
public Layer HardSigmoid(string name, object input, float alpha = 0.2, float beta = 0.5)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | alpha | alpha |
| float | beta | beta |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Identity(string, object, int)
No-op layer
Declaration
public Layer Identity(string name, object input, int rank = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int | rank | input rank |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Input(string, int, int)
Add an input to the model
Declaration
public Model.Input Input(string name, int batch, int channels)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | input name |
| int | batch | input batch size |
| int | channels | input channel count |
Returns
| Type | Description |
|---|---|
| Model.Input | Input instance |
Input(string, int, int, int, int)
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 | input name |
| int | batch | input batch size |
| int | height | input height |
| int | width | input width |
| int | channels | input channel count |
Returns
| Type | Description |
|---|---|
| Model.Input | Input instance |
Input(string, int[], int)
Add an input to the model
Declaration
public Model.Input Input(string name, int[] shape, int rank)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | input name |
| int[] | shape | input shape |
| int | rank | input rank |
Returns
| Type | Description |
|---|---|
| Model.Input | Input instance |
Input(string, TensorShape)
Add an input to the model
Declaration
public Model.Input Input(string name, TensorShape shape)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | input name |
| TensorShape | shape | input shape |
Returns
| Type | Description |
|---|---|
| Model.Input | Input instance |
LRN(string, object, float, float, float, int)
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 | Layer name |
| object | input | input node |
| float | alpha | alpha |
| float | beta | beta |
| float | bias | bias |
| int | size | size |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
LSTM(string, object, string[], object, object, object, int, object, object)
LSTM
Declaration
public Layer[] LSTM(string name, object input, string[] outputs, object w, object r, object b, int hiddenSize, object initialHidden = null, object initialCell = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| string[] | outputs | output nodes |
| object | w | W data |
| object | r | R data |
| object | b | B data (optional) |
| int | hiddenSize | Number of neurons in the hidden layer |
| object | initialHidden | Initial value of the hidden layer (optional) |
| object | initialCell | Initial value of the hidden layer (optional) |
Returns
| Type | Description |
|---|---|
| Layer[] | created Layer instances |
LeakyRelu(string, object, float)
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.01)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | alpha | alpha |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
LogSoftmax(string, object, int, bool)
Return the logSoftmax (log of normalized exponential) values of the input along flatWidth of the input tensor.
Thus output will be of shape of the input.
If axisIs8D==true axis rank is from [S,R,N,T,D,H,W,C] otherwise 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 LogSoftmax(string name, object input, int axis = 3, bool axisIs8D = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int | axis | axis |
| bool | axisIs8D | is axis 8D |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | left input node |
| object | input1 | right input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input0 | first input node |
| object | input1 | second input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
MaxPool2D(string, object, int[], int[], int[])
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 | Layer name |
| object | input | input node |
| int[] | pool | pooling |
| int[] | stride | stride |
| int[] | pad | padding |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | reference input object, could be |
| object | output | reference output object, could be |
| TensorShape | shape | memory shape |
Returns
| Type | Description |
|---|---|
| Model.Memory | Memory instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Multinomial(string, object, int, float)
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 | Layer name |
| object | input | input node |
| int | numberOfSamplesDrawnPerInputChannel | number of samples drawn per input channel |
| float | seed | seed |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
NonMaxSuppression(string, object, object, object, object, object, int)
Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes with score less than scoreThreshold are removed.
Declaration
public Layer NonMaxSuppression(string name, object boxes, object scores, object maxOutputBoxesPerClass, object iouThreshold, object scoreThreshold, int centerPointBox)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | boxes | boxes input node |
| object | scores | scores input node |
| object | maxOutputBoxesPerClass | max output boxes per class input node |
| object | iouThreshold | IOU threshold input node |
| object | scoreThreshold | score input node |
| int | centerPointBox | center point box |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
NonZero(string, object)
Returns the indices of the elements that are non-zero For example an input tensor of shape(1,2,3,1): [0, 2, 3], [4, 1, 0]
Would return a tensor of shape(2, 1, 1, 4) N = 2 as the rank of input tensor is 2. C = 4 as there exist 3 non zero value in input tensor. [0, 0, 1, 1], [1, 2, 0, 1]
Declaration
public Layer NonZero(string name, object input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Normalization(string, object, Tensor, Tensor, float)
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-05)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| Tensor | scale | scale |
| Tensor | bias | bias |
| float | epsilon | epsilon |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
OneHot(string, object, int, int, int)
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 | Layer name |
| object | input | input node |
| int | depth | depth |
| int | on | on value |
| int | off | off value |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Output(object)
Add an output to the model
Declaration
public string Output(object input)
Parameters
| Type | Name | Description |
|---|---|---|
| object | input | reference object, could be |
Returns
| Type | Description |
|---|---|
| string | Output instance |
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 | Layer name |
| object | input | input node |
| object | slope | slope input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Pad2DEdge(string, object, int[])
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 | Layer name |
| object | input | input node |
| int[] | pad | padding |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Pad2DReflect(string, object, int[])
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 | Layer name |
| object | input | input node |
| int[] | pad | padding |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Pad2DSymmetric(string, object, int[])
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 Pad2DSymmetric(string name, object input, int[] pad)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | pad | padding |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Pow(string, object, float)
Element-wise Pow activation function: f(x) = pow(x, alpha)
Declaration
public Layer Pow(string name, object input, float alpha)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | alpha | power input will be raised to |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
RandomNormal(string, object, float, float, float)
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 | Layer name |
| object | input | input node |
| float | mean | mean |
| float | scale | scale |
| float | seed | seed |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
RandomNormal(string, TensorShape, float, float, float)
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 | Layer name |
| TensorShape | shape | shape |
| float | mean | mean |
| float | scale | scale |
| float | seed | seed |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
RandomUniform(string, object, float, float, float)
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 | Layer name |
| object | input | input node |
| float | min | min |
| float | max | max |
| float | seed | seed |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
RandomUniform(string, TensorShape, float, float, float)
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 | Layer name |
| TensorShape | shape | shape |
| float | min | min |
| float | max | max |
| float | seed | seed |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Range(string, object, object, object)
Generate a tensor containing a sequence of numbers that begin at start and extends by increments of delta up to limit (exclusive).
the number of elements are defined as follows:
number_of_elements = max( ceil( (limit - start) / delta ) , 0 )
output is calculated as follows:
output[i] = start + (i * delta)
Declaration
public Layer Range(string name, object start, object limit, object delta)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | start | start |
| object | limit | limit |
| object | delta | delta |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Reduce(Type, string, object, int, bool, int)
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, int keepDims = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| Layer.Type | type | operation type |
| string | name | Layer name |
| object | input | input node |
| int | axis | axis |
| bool | axisIs8D | is axis 8D |
| int | keepDims | is shape rank reduced |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Resample2D(string, object, int[], bool)
Resample2D scales the input tensor to the given resolution (W=size[0], H=size[1]).
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 | Layer name |
| object | input | input node |
| int[] | size | size |
| bool | bilinear | use bilinear |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Reshape(string, object, int[], int)
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, int rank = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | shape | shape |
| int | rank | rank |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Reshape(string, object, object)
Return a tensor of the shape given as tensor.
Declaration
public Layer Reshape(string name, object input, object shape)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| object | shape | shape |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
| TensorShape | shape | shape |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
RoiAlign(string, object, object, object, int, int, int, float)
Performs RoiAlign as described in the Mask R-CNN paper
Declaration
public Layer RoiAlign(string name, object input, object rois, object batchIndices, int outputHeight, int outputWidth, int samplingRatio, float spatialScale)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| object | input | |
| object | rois | |
| object | batchIndices | |
| int | outputHeight | outputHeight |
| int | outputWidth | outputWidth |
| int | samplingRatio | samplingRatio |
| float | spatialScale | spatialScale |
Returns
| Type | Description |
|---|---|
| Layer | output Tensor |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
| Tensor | scale | scale data Tensor |
| Tensor | bias | bias data Tensor |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
ScatterND(string, object, object, object, ScatterNDReductionMode)
Declaration
public Layer ScatterND(string name, object input, object indices, object updates, Layer.ScatterNDReductionMode reductionType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| object | input | |
| object | indices | |
| object | updates | |
| Layer.ScatterNDReductionMode | reductionType |
Returns
| Type | Description |
|---|---|
| Layer |
Selu(string, object, float, float)
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.67326, float gamma = 1.0507)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| float | alpha | alpha |
| float | gamma | gamma |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Shape(string, object, int)
Takes a tensor as input and outputs a tensor containing the shape of the input tensor. Optionally, if an axis is specified, then it will return only that part of the shape.
Declaration
public Layer Shape(string name, object input, int axis = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int | axis | axis |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Sign(string, object)
Declaration
public Layer Sign(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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Softmax(string, object, int, bool)
Return the Softmax (normalized exponential) values of the input along provided axis.
Thus output will be of shape of the input.
If axisIs8D==true axis rank is from [S,R,N,T,D,H,W,C] otherwise 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 Softmax(string name, object input, int axis = 3, bool axisIs8D = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int | axis | axis |
| bool | axisIs8D | is axis 8D |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Softplus(string, object)
Element-wise Softplus activation function: f(x) = ln(e^ + 1)
Declaration
public Layer Softplus(string name, object input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
SpaceToDepth(string, object, int)
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 | Layer name |
| object | source | input node |
| int | blocksize | block size |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Sqrt(string, object)
Element-wise Sqrt activation function
Declaration
public Layer Sqrt(string name, object input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
StridedSlice(string, object, int[], int[], int[])
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 | Layer name |
| object | input | input node |
| int[] | starts | starts |
| int[] | ends | ends |
| int[] | strides | strides |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object[] | inputs | input nodes |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
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 | Layer name |
| object | input | input node |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Tile(string, object, int[])
Constructs a tensor by repeating the input tensor the number of times given by repeats For example input = [[1, 2], [3, 4]], repeats = [1, 2], Tile(input, repeats) = [[1, 2, 1, 2], [3, 4, 3, 4]]
Declaration
public Layer Tile(string name, object input, int[] repeats)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | repeats | tile repeats |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
TopKIndices(string, object, object, int, bool, bool)
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 | Layer name |
| object | input | input node |
| object | k | k |
| int | axis | axis |
| bool | largest | largest |
| bool | sorted | sorted |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
TopKValues(string, object, object, int)
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 | Layer name |
| object | input | input node |
| object | indices | indices node |
| int | axis | axis |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Transpose(string, object, int[])
Transpose
Declaration
public Layer Transpose(string name, object input, int[] permutations)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | permutations | list of axis permutations |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Upsample2D(string, object, int[], bool)
Upsample the input tensor by scaling W and H by upsample[0] and upsample[1] respectively.
bilinear allow to choose between nearest neighbor or bilinear upsampling.
Declaration
public Layer Upsample2D(string name, object input, int[] upsample, bool bilinear)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | upsample | upsampling |
| bool | bilinear | use bilinear |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Upsample2D(string, object, object, bool)
Upsample the input tensor
Declaration
public Layer Upsample2D(string name, object source, object scale, bool bilinear)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | source | source input node |
| object | scale | scale input node |
| bool | bilinear | use bilinear |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Upsample3D(string, object, int[], bool)
Upsample the input tensor by scaling W,H and D by upsample[0], upsample[1] and upsample[2] respectively.
trilinear allow to choose between nearest neighbor or trilinear upsampling.
Declaration
public Layer Upsample3D(string name, object input, int[] upsample, bool trilinear)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | input | input node |
| int[] | upsample | scaling factors array [W,H,D] |
| bool | trilinear | trilinear flag |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Upsample3D(string, object, object, bool)
Upsample the input tensor by scaling W,H and D by scale[0], scale[1] and scale[2] respectively.
trilinear allow to choose between nearest neighbor or trilinear upsampling.
Declaration
public Layer Upsample3D(string name, object source, object scale, bool trilinear)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | source | input node |
| object | scale | scale Tensor |
| bool | trilinear | trilinear flag |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |
Where(string, object, object, object)
Return elements, either from X or Y, depending on condition (with broadcasting support, based on the shape of the condition) Return X elementwise if condition is true Y otherwise. Input is consider false if 0.0 elementwise true otherwise.
Declaration
public Layer Where(string name, object condition, object input1, object input2)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Layer name |
| object | condition | condition |
| object | input1 | first input |
| object | input2 | second input |
Returns
| Type | Description |
|---|---|
| Layer | created Layer instance |