Class ModelBuilder
Class responsible for run-time model building from Neural Net primitives.
Inherited Members
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 | 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, 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 | Layer name |
Object | input | input node |
Int32[] | pool | pooling |
Int32[] | stride | stride |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Int32[] | pad | padding |
Single | constantValue | border constant value |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Border3D(String, Object, Int32[], Single)
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 = 0F)
Parameters
Type | Name | Description |
---|---|---|
String | name | Layer name |
Object | input | input node |
Int32[] | pad | padding |
Single | 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, Single, Single)
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 |
Single | min | min |
Single | max | max |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object[] | inputs | input node |
Int32 | axis | axis |
Boolean | axisIs8D | is axis 8D |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Const(String, Tensor, Int32, Int32)
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 |
Int32 | insertionIndex | insertion index in Layer list |
Int32 | rank | constant rank |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
ConstantOfShape(String, Object, Single)
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 |
Single | value | value |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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.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 |
Int32[] | stride | stride |
Int32[] | pad | padding |
Tensor | kernel | kernel weight data Tensor |
Tensor | bias | bias data Tensor |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Int32[] | stride | stride |
Int32[] | pad | padding |
Int32[] | outputPad | output padding |
Tensor | kernel | kernel weight data Tensor |
Tensor | bias | bias data Tensor |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Conv3D(String, Object, Int32[], Int32[], 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 |
Int32[] | stride | stride |
Int32[] | 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, 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 | Layer name |
Object | source | input node |
Int32 | blocksize | block size |
String | mode | mode, see |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Int32[] | stride | stride |
Int32[] | 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, 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 | Layer name |
Object | input | input node |
Single | 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^{x}
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, 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 | Layer name |
Object | input | input node |
Int32[] | 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, 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 | Layer name |
Object | input | input node |
Object | indices | indices |
Int32 | axis | axis |
Boolean | 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, Single, Single)
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.2F, float beta = 0.5F)
Parameters
Type | Name | Description |
---|---|---|
String | name | Layer name |
Object | input | input node |
Single | alpha | alpha |
Single | beta | beta |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Identity(String, Object, Int32)
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 |
Int32 | rank | input rank |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | input name |
Int32 | batch | input batch size |
Int32 | channels | input channel count |
Returns
Type | Description |
---|---|
Model.Input | Input instance |
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 | input name |
Int32 | batch | input batch size |
Int32 | height | input height |
Int32 | width | input width |
Int32 | channels | input channel count |
Returns
Type | Description |
---|---|
Model.Input | Input instance |
Input(String, Int32[], Int32)
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 |
Int32[] | shape | input shape |
Int32 | 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 |
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 | Layer name |
Object | input | input node |
Single | 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 |
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 |
LogSoftmax(String, Object, Int32, Boolean)
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 |
Int32 | axis | axis |
Boolean | axisIs8D | is axis 8D |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Single | alpha | alpha |
Single | beta | beta |
Single | bias | bias |
Int32 | size | size |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
LSTM(String, Object, String[], Object, Object, Object, Int32, 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) |
Int32 | 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 |
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, 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 | Layer name |
Object | input | input node |
Int32[] | pool | pooling |
Int32[] | stride | stride |
Int32[] | 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, 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 | Layer name |
Object | input | input node |
Int32 | numberOfSamplesDrawnPerInputChannel | number of samples drawn per input channel |
Single | 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, Int32)
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 |
Int32 | 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, 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 | Layer name |
Object | input | input node |
Tensor | scale | scale |
Tensor | bias | bias |
Single | epsilon | epsilon |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Int32 | depth | depth |
Int32 | on | on value |
Int32 | 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 |
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 | Layer name |
Object | input | input node |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Pad2DSymmetric(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 Pad2DSymmetric(string name, object input, int[] pad)
Parameters
Type | Name | Description |
---|---|---|
String | name | Layer name |
Object | input | input node |
Int32[] | pad | padding |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Pow(String, Object, Single)
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 |
Single | 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 |
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 |
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 | Layer name |
Object | input | input node |
Single | mean | mean |
Single | scale | scale |
Single | seed | seed |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
TensorShape | shape | shape |
Single | mean | mean |
Single | scale | scale |
Single | seed | seed |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Single | min | min |
Single | max | max |
Single | seed | seed |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
TensorShape | shape | shape |
Single | min | min |
Single | max | max |
Single | 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(Layer.Type, String, Object, Int32, Boolean, Int32)
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 |
Int32 | axis | axis |
Boolean | axisIs8D | is axis 8D |
Int32 | 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, Int32[], Boolean)
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 |
Int32[] | size | size |
Boolean | bilinear | use bilinear |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Reshape(String, Object, Int32[], 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, int rank = -1)
Parameters
Type | Name | Description |
---|---|---|
String | name | Layer name |
Object | input | input node |
Int32[] | shape | shape |
Int32 | 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, Int32, Int32, Int32, Single)
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 | |
Int32 | outputHeight | outputHeight |
Int32 | outputWidth | outputWidth |
Int32 | samplingRatio | samplingRatio |
Single | 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, Layer.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, 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 | Layer name |
Object | input | input node |
Single | alpha | alpha |
Single | gamma | gamma |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Shape(String, Object, Int32)
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 |
Int32 | 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, Int32, Boolean)
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 |
Int32 | axis | axis |
Boolean | axisIs8D | is axis 8D |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Softplus(String, Object)
Element-wise Softplus
activation function: f(x) = ln(e^{x} + 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, 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 | Layer name |
Object | source | input node |
Int32 | 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, 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 | Layer name |
Object | input | input node |
Int32[] | starts | starts |
Int32[] | ends | ends |
Int32[] | 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, Int32[])
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 |
Int32[] | repeats | tile repeats |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Object | k | k |
Int32 | axis | axis |
Boolean | largest | largest |
Boolean | sorted | sorted |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
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 | Layer name |
Object | input | input node |
Object | indices | indices node |
Int32 | axis | axis |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Transpose(String, Object, Int32[])
Transpose
Declaration
public Layer Transpose(string name, object input, int[] permutations)
Parameters
Type | Name | Description |
---|---|---|
String | name | Layer name |
Object | input | input node |
Int32[] | permutations | list of axis permutations |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Upsample2D(String, Object, Int32[], Boolean)
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 |
Int32[] | upsample | upsampling |
Boolean | bilinear | use bilinear |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Upsample2D(String, Object, Object, Boolean)
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 |
Boolean | bilinear | use bilinear |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Upsample3D(String, Object, Int32[], Boolean)
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 |
Int32[] | upsample | scaling factors array [W,H,D] |
Boolean | trilinear | trilinear flag |
Returns
Type | Description |
---|---|
Layer | created Layer instance |
Upsample3D(String, Object, Object, Boolean)
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 |
Boolean | 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 |