From 345b312c00391ae93cfddd2cbcd910de69fba59d Mon Sep 17 00:00:00 2001 From: Mrityunjay Tripathi Date: Mon, 3 Aug 2020 12:24:26 +0530 Subject: [PATCH] add comments about matrix dimensions --- src/mlpack/methods/ann/layer/lookup_impl.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mlpack/methods/ann/layer/lookup_impl.hpp b/src/mlpack/methods/ann/layer/lookup_impl.hpp index aed3cfe7d5..378662a15e 100644 --- a/src/mlpack/methods/ann/layer/lookup_impl.hpp +++ b/src/mlpack/methods/ann/layer/lookup_impl.hpp @@ -41,6 +41,11 @@ void Lookup::Forward( for (size_t i = 0; i < batchSize; ++i) { + //! ith column of output is a vectorized form of a matrix of shape + //! (seqLength, embeddingSize) selected as a combination of rows from the + //! weights. It is done to ensure that the feature dimension remains beside + //! the batch dimension when vectorized form is unpacked for some other + //! layer. output.col(i) = arma::vectorise(weights.rows( arma::conv_to::from(input.col(i)) - 1)); }