[mlpack-git] master: Fix typo and minor style change. (c8d5b3d)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Jun 11 17:10:16 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/3ade9299e8f3c1e73ba30bff276b51813ede87b5...f4d8e7075ff00ac483b7aeaa01c3ffe4645e9bfc

>---------------------------------------------------------------

commit c8d5b3d29a72080aebba04fdfd146dc6f8ec407e
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date:   Wed Jun 10 22:05:36 2015 +0200

    Fix typo and minor style change.


>---------------------------------------------------------------

c8d5b3d29a72080aebba04fdfd146dc6f8ec407e
 .../methods/ann/connections/full_connection.hpp    | 23 +++++++++++-----------
 src/mlpack/methods/ann/layer/neuron_layer.hpp      |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/mlpack/methods/ann/connections/full_connection.hpp b/src/mlpack/methods/ann/connections/full_connection.hpp
index 7b6a4b9..0b851fb 100644
--- a/src/mlpack/methods/ann/connections/full_connection.hpp
+++ b/src/mlpack/methods/ann/connections/full_connection.hpp
@@ -150,8 +150,8 @@ class FullConnection
   }
 
   /*
-   * Calculate the gradient using the output delta (dense matrix) and the input
-   * activation (dense matrix).
+   * Calculate the gradient (dense matrix) using the output delta (dense matrix)
+   * and the input activation (dense matrix).
    *
    * @param gradient The calculated gradient.
    */
@@ -162,15 +162,15 @@ class FullConnection
   }
 
   /*
-   * Calculate the gradient using the output delta (3rd oder tensor) and the
-   * input activation (3rd oder tensor).
+   * Calculate the gradient (3rd order tensor) using the output delta
+   * (3rd order tensor) and the input activation (3rd order tensor).
    *
    * @param gradient The calculated gradient.
    */
   template<typename eT>
   void Gradient(arma::Cube<eT>& gradient)
   {
-     GradientDelta(outputLayer.Delta(), gradient);
+     GradientDelta(inputLayer.InputActivation(), gradient);
   }
 
   //! Get the weights.
@@ -200,13 +200,13 @@ class FullConnection
 
  private:
    /*
-   * Calculate the gradient using the output delta (3rd oder tensor) and the
-   * input activation (3rd oder tensor).
+   * Calculate the gradient using the output delta (3rd order tensor) and the
+   * input activation (3rd order tensor).
    *
    * @param gradient The calculated gradient.
    */
   template<typename eT>
-  void GradientDelta(arma::Mat<eT>& /* unused */, arma::Cube<eT>& gradient)
+  void GradientDelta(arma::Cube<eT>& /* unused */, arma::Cube<eT>& gradient)
   {
     gradient = arma::Cube<eT>(weights.n_rows, weights.n_cols, 1);
     arma::Mat<eT> data = arma::Mat<eT>(outputLayer.Delta().n_cols,
@@ -229,15 +229,16 @@ class FullConnection
   }
 
   /*
-   * Calculate the gradient using the output delta (3rd oder tensor) and the
-   * input activation (3rd oder tensor).
+   * Calculate the gradient (3rd order tensor) using the output delta
+   * (dense matrix) and the input activation (dense matrix).
    *
    * @param gradient The calculated gradient.
    */
   template<typename eT>
-  void GradientDelta(arma::Cube<eT>& /* unused */, arma::Cube<eT>& gradient)
+  void GradientDelta(arma::Mat<eT>& /* unused */, arma::Cube<eT>& gradient)
   {
     gradient = arma::Cube<eT>(weights.n_rows, weights.n_cols, 1);
+    Gradient(gradient.slice(0));
   }
 
   //! Locally-stored weight object.
diff --git a/src/mlpack/methods/ann/layer/neuron_layer.hpp b/src/mlpack/methods/ann/layer/neuron_layer.hpp
index d6d9ef1..e1abdb7 100644
--- a/src/mlpack/methods/ann/layer/neuron_layer.hpp
+++ b/src/mlpack/methods/ann/layer/neuron_layer.hpp
@@ -93,7 +93,7 @@ class NeuronLayer
       inputActivations(arma::zeros<DataType>(layerRows, layerCols,
           layerSlices * outputMaps)),
       delta(arma::zeros<DataType>(layerRows, layerCols,
-          layerSlices  * outputMaps)),
+          layerSlices * outputMaps)),
       layerRows(layerRows),
       layerCols(layerCols),
       layerSlices(layerSlices),



More information about the mlpack-git mailing list