Methods
# inner denseLayer(units, inputShape, activation) → {Dense}
Creates a dense (fully connected) layer.
Parameters:
Name | Type | Description |
---|---|---|
units |
Number
|
Positive integer, dimensionality of the output space. |
inputShape |
Array.<Number>
|
null
|
If defined, will be used to create an input layer to insert before this layer. If both inputShape and batchInputShape are defined, batchInputShape will be used. This argument is only applicable to input layers (the first layer of a model). |
activation |
String
|
('elu'|'hardSigmoid'|'linear'|'relu'|'relu6'| 'selu'|'sigmoid'|'softmax'|'softplus'|'softsign'|'tanh'|'swish'|'mish'|'gelu'|'gelu_new') Activation function to use. |
tf.layers.dense({
units, inputShape, activation}).
Dense
# inner dropoutLAyer(rate) → {Flatten}
Applies dropout to the input.
Parameters:
Name | Type | Description |
---|---|---|
rate |
Number
|
Float between 0 and 1. Fraction of the input units to drop. |
tf.layers.dropout({rate}).
Flatten
# inner embeddingLayer(inputDime, outputDim, inputLength, trainable) → {Dense}
Maps positive integers (indices) into dense vectors of fixed size.
Parameters:
Name | Type | Description |
---|---|---|
inputDime |
Number
|
Integer > 0. Size of the vocabulary, i.e. maximum integer index + 1. |
outputDim |
Number
|
Integer >= 0. Dimension of the dense embedding. |
inputLength |
Number
|
Array.<Number>
|
Length of input sequences, when it is constant. |
trainable |
Boolean
|
Whether the weights of this layer are updatable by fit. Defaults to true. |
tf.layers.embedding({ inputDim, outputDim, inputLength, trainable })
Dense
# inner flattenLayer(inputShape) → {Flatten}
Flattens the input. Does not affect the batch size.
Parameters:
Name | Type | Description |
---|---|---|
inputShape |
Number
|
If defined, will be used to create an input layer to insert before this layer. If both inputShape and batchInputShape are defined, batchInputShape will be used. This argument is only applicable to input layers (the first layer of a model). |
tf.layers.flatten({inputShape}).
Flatten