A densely-connected neural network layer.
Dense implements the operation
activation(matmul(input, weight) + bias), where
a weight matrix,
bias is a bias vector, and
activation is an element-wise activation
This layer also supports 3-D weight tensors with 2-D bias matrices. In this case the first
dimension of both is treated as the batch size that is aligned with the first dimension of
input and the batch variant of the
matmul(_:_:) operation is used, thus using a different
weight and bias for each element in input batch.
The weight matrix.
public var weight: Tensor<Scalar>
The bias vector.
public var bias: Tensor<Scalar>
The element-wise activation function.
@noDerivative public let activation: Activation
Denselayer with the specified input size, output size, and element-wise activation function. The weight matrix is created with shape
[inputSize, outputSize]and the bias vector is created with shape