Tensorflow Layers for Noodle
All layers here could be called via tf.keras.layers.LayerName(...)
. Usage:
input_layer = tf.keras.Input(shape=INPUT_SHAPE)
conv_1 = layers.Conv2D(32, (3, 3), padding='same', activation='relu',)(input_layer)
conv_2 = layers.Conv2D(32, (3, 3), padding='same', activation='relu',)(conv_1)
skip_1 = layers.Add()([conv_1, conv_2])
Activations
Some of layers support 'activation'
parameter. For every of such layers, this parameter could be equal to None
or one of these string values:
'elu'
'linear'
'relu'
'selu'
'sigmoid'
'softmax'
'softplus'
'softsign'
'swish'
'tanh'
BatchNormalization
Parameters
Nothing to support at the MVP.
Shape changes
No.
Concatenate
Takes the list of inputs, not just one input: concatenated = tf.keras.layers.Concatenate()([input_1, input_2, input_3])
. Inputs shape should be the same except the last axis.
Parameters
Nothing to support at the MVP.
Shape changes
The size of the last axis is summarized over all inputs, i.e. the result of concatenation of layers with shapes of [A, B, X]
, [A, B, Y]
, and [A, B, Z]
will be [A, B, X + Y + Z]
.
Conv1D
Takes only 2D data as an input.
Parameters
filters
: positive integerkernel_size
: positive integerpadding
: either'valid'
or'same'
activation
: as mentioned in the "Activations" section
Shape changes
For input of shape [X, Y]
returns output of shape [X - kernel_size + 1, filters]
if padding == 'valid'
or [X, filters]
if padding == 'same'
.
Conv2D
Takes only 3D data as an input.
Parameters
filters
: positive integerkernel_size
: tuple of 2 positive integerspadding
: either'valid'
or'same'
activation
: as mentioned in the "Activations" section
Shape changes
For input of shape [X, Y, Z]
returns output of shape [X - kernel_size[0] + 1, Y - kernel_size[1] + 1, filters]
if padding == 'valid'
or [X, Y, filters]
if padding == 'same'
.
Conv3D
Takes only 4D data as an input.
Parameters
filters
: positive integerkernel_size
: tuple of 3 positive integerspadding
: either'valid'
or'same'
activation
: as mentioned in the "Activations" section
Shape changes
For input of shape [X, Y, Z, F]
returns output of shape [X - kernel_size[0] + 1, Y - kernel_size[1] + 1, F - kernel_size[2] + 1, filters]
if padding == 'valid'
or [X, Y, Z, filters]
if padding == 'same'
.
Dense
Takes only 1D data as an input. (Actually it depends on the library version, not important for MVP)
Parameters
units
: positive integeractivation
: as mentioned in the "Activations" section
Shape changes
Returns array of shape [units]
.
Flatten
Accepts any data, no parameters.
Shape change
Returns a 1D array with axis size multiplied over all axis of the input array, e.g. converts input of shape [X, Y, Z]
to 1D array of shape [X * Y * Z]
.