From 3ef6f05ba069b880e83782914f7aaca4e6dfa74e Mon Sep 17 00:00:00 2001 From: Saksham Bansal <7020962+saksham189@users.noreply.github.com> Date: Wed, 26 Dec 2018 22:32:47 +0700 Subject: [PATCH] ffn.hpp and rnn.hpp: Documentation fix Documentation fix for EvaluateWithGradient. --- src/mlpack/methods/ann/ffn.hpp | 4 ++-- src/mlpack/methods/ann/rnn.hpp | 3 +-- src/mlpack/methods/ann/rnn_impl.hpp | 9 +++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mlpack/methods/ann/ffn.hpp b/src/mlpack/methods/ann/ffn.hpp index 4cfbd5f5db..12958fe3ef 100644 --- a/src/mlpack/methods/ann/ffn.hpp +++ b/src/mlpack/methods/ann/ffn.hpp @@ -191,6 +191,7 @@ class FFN /** * Evaluate the feedforward network with the given parameters. * This function is usually called by the optimizer to train the model. + * This just calls the overload of EvaluateWithGradient() with batchSize = 1. * * @param parameters Matrix model parameters. * @param gradient Matrix to output gradient into. @@ -201,8 +202,7 @@ class FFN /** * Evaluate the feedforward network with the given parameters, but using only * a number of data points. This is useful for optimizers such as SGD, which - * require a separable objective function. This just calls the overload of - * Evaluate() with deterministic = true. + * require a separable objective function. * * @param parameters Matrix model parameters. * @param begin Index of the starting point to use for objective function diff --git a/src/mlpack/methods/ann/rnn.hpp b/src/mlpack/methods/ann/rnn.hpp index 98dc845c02..ef74fe8c6a 100644 --- a/src/mlpack/methods/ann/rnn.hpp +++ b/src/mlpack/methods/ann/rnn.hpp @@ -183,8 +183,7 @@ class RNN /** * Evaluate the recurrent neural network with the given parameters. This - * function is usually called by the optimizer to train the model. This just - * calls the other overload of Evaluate() with deterministic = true. + * function is usually called by the optimizer to train the model. * * @param parameters Matrix model parameters. * @param begin Index of the starting point to use for objective function diff --git a/src/mlpack/methods/ann/rnn_impl.hpp b/src/mlpack/methods/ann/rnn_impl.hpp index 0b1567b4ea..a703f3b96d 100644 --- a/src/mlpack/methods/ann/rnn_impl.hpp +++ b/src/mlpack/methods/ann/rnn_impl.hpp @@ -304,13 +304,10 @@ EvaluateWithGradient(const arma::mat& /* parameters */, responseSeq = seqNum; } - if (!deterministic) + for (size_t l = 0; l < network.size(); ++l) { - for (size_t l = 0; l < network.size(); ++l) - { - boost::apply_visitor(SaveOutputParameterVisitor( - std::move(moduleOutputParameter)), network[l]); - } + boost::apply_visitor(SaveOutputParameterVisitor( + std::move(moduleOutputParameter)), network[l]); } performance += outputLayer.Forward(std::move(boost::apply_visitor(