12 #ifndef MLPACK_METHODS_ANN_LAYER_GROUPNORM_HPP 13 #define MLPACK_METHODS_ANN_LAYER_GROUPNORM_HPP 47 typename InputDataType = arma::mat,
48 typename OutputDataType = arma::mat
62 GroupNorm(
const size_t groupCount,
const size_t size,
const double eps = 1e-8);
78 void Forward(
const arma::Mat<eT>& input, arma::Mat<eT>& output);
88 void Backward(
const arma::Mat<eT>& input,
89 const arma::Mat<eT>& gy,
100 void Gradient(
const arma::Mat<eT>& input,
101 const arma::Mat<eT>& error,
102 arma::Mat<eT>& gradient);
115 OutputDataType
const&
Delta()
const {
return delta; }
117 OutputDataType&
Delta() {
return delta; }
120 OutputDataType
const&
Gradient()
const {
return gradient; }
125 OutputDataType
Mean() {
return mean; }
151 template<
typename Archive>
152 void serialize(Archive& ar,
const uint32_t );
168 OutputDataType gamma;
174 OutputDataType weights;
180 OutputDataType variance;
183 OutputDataType gradient;
186 OutputDataType delta;
189 OutputDataType outputParameter;
192 OutputDataType normalized;
198 OutputDataType inputMean;
205 #include "group_norm_impl.hpp" OutputDataType & Gradient()
Modify the gradient.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Declaration of the Group Normalization class.
void Reset()
Reset the layer parameters.
OutputDataType & Delta()
Modify the delta.
size_t InSize() const
Get the number of input units.
OutputDataType const & Gradient() const
Get the gradient.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType & Parameters()
Modify the parameters.
OutputDataType const & Parameters() const
Get the parameters.
void Backward(const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
Backward pass through the layer.
double Epsilon() const
Get the value of epsilon.
OutputDataType const & Delta() const
Get the delta.
size_t GroupCount() const
Get the group count.
GroupNorm()
Create the GroupNorm object.
OutputDataType Variance()
Get the variance across single training data.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Forward pass of Group Normalization.
size_t InputShape() const
Get the shape of the input.
OutputDataType const & OutputParameter() const
Get the output parameter.
void serialize(Archive &ar, const uint32_t)
Serialize the layer.
OutputDataType Mean()
Get the mean across single training data.