13 #ifndef MLPACK_METHODS_ANN_LAYER_LINEAR3D_HPP 14 #define MLPACK_METHODS_ANN_LAYER_LINEAR3D_HPP 35 typename MatType = arma::mat,
36 typename RegularizerType = NoRegularizer
52 RegularizerType regularizer = RegularizerType());
72 void SetWeights(
typename MatType::elem_type* weightsPtr);
81 void Forward(
const MatType& input, MatType& output);
104 const MatType& error,
113 MatType
const&
Weight()
const {
return weight; }
118 MatType
const&
Bias()
const {
return bias; }
120 MatType&
Bias() {
return bias; }
131 template<
typename Archive>
132 void serialize(Archive& ar,
const uint32_t );
148 RegularizerType regularizer;
158 #include "linear3d_impl.hpp" size_t WeightSize() const
Return the number of weight elements.
void Gradient(const MatType &input, const MatType &error, MatType &gradient)
Calculate the gradient using the output delta and the input activation.
std::vector< size_t > inputDimensions
Logical input dimensions of each point.
Linear3DType()
Create the Linear3D object.
void Forward(const MatType &input, MatType &output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
MatType & Weight()
Modify the weight of the layer.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Implementation of the Linear3D layer class.
MatType const & Bias() const
Get the bias of the layer.
MatType & Bias()
Modify the bias weights of the layer.
MatType const & Weight() const
Get the weight of the layer.
MatType & Parameters()
Modify the parameters.
void ComputeOutputDimensions()
Compute the output dimensions for the layer, using InputDimensions().
Linear3DType & operator=(const Linear3DType &other)
Copy the given Linear3DType (but not weights).
Linear3DType< arma::mat, NoRegularizer > Linear3D
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
void SetWeights(typename MatType::elem_type *weightsPtr)
Reset the layer parameter.
MatType const & Parameters() const
Get the parameters.
A layer is an abstract class implementing common neural networks operations, such as convolution...
void Backward(const MatType &, const MatType &gy, MatType &g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
Linear3DType * Clone() const
Clone the Linear3DType object. This handles polymorphism correctly.