From ed8881d2b6200e54828f0efbd2b7b2840838ee71 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 13 Jul 2021 17:48:46 -0400 Subject: [PATCH] Uncomment another test. --- src/mlpack/tests/feedforward_network_test.cpp | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 774aaf60a7..a8cba65428 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -260,9 +260,9 @@ TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") */ TEST_CASE("CheckCopyMovingConcatenateTest", "[FeedForwardNetworkTest]") { - // Create training input by 5x5 matrix. - arma::mat input = arma::randu(10,1); - // Create training output by 1 matrix. + // Create training input as a 10x1 matrix. + arma::mat input = arma::randu(10, 1); + // Create training output (one value) matrix. arma::mat output = arma::mat("1"); // Check copying constructor. @@ -725,14 +725,14 @@ TEST_CASE("FFSerializationTest", "[FeedForwardNetworkTest]") /** * Test the overload of Forward function which allows partial forward pass. - * + */ TEST_CASE("PartialForwardTest", "[FeedForwardNetworkTest]") { FFN, RandomInitialization> model; model.Add(10); - // Add a new Add<> module which adds a constant term to the input. - Add* addModule = new Add(10); + // Add a new Add<> module which adds a (learnable) constant term to the input. + Add* addModule = new Add(); model.Add(addModule); LinearNoBias* linearNoBiasModule = new LinearNoBias(10); @@ -740,6 +740,9 @@ TEST_CASE("PartialForwardTest", "[FeedForwardNetworkTest]") model.Add(10); + // Set up the network for inputs of dimensionality 10. + model.Reset(10); + // Set the parameters of the Add<> module to a matrix of ones. addModule->Parameters() = arma::ones(10, 1); // Set the parameters of the LinearNoBias<> module to a matrix of ones. @@ -751,8 +754,8 @@ TEST_CASE("PartialForwardTest", "[FeedForwardNetworkTest]") // Forward pass only through the Add module. model.Forward(input, output, - 1 /* Index of the Add module *, - 1 /* Index of the Add module *); + 1 /* Index of the Add module */, + 1 /* Index of the Add module */); // As we only forward pass through Add module, input and output should // differ by a matrix of ones. @@ -761,14 +764,13 @@ TEST_CASE("PartialForwardTest", "[FeedForwardNetworkTest]") // Forward pass only through the Add module and the LinearNoBias module. model.Forward(input, output, - 1 /* Index of the Add module *, - 2 /* Index of the LinearNoBias module *); + 1 /* Index of the Add module */, + 2 /* Index of the LinearNoBias module */); // As we only forward pass through Add module followed by the LinearNoBias // module, output should be a matrix of 20s.(output = weight * input) CheckMatrices(output, arma::ones(10, 1) * 20); } -*/ /** * Test that FFN::Train() returns finite objective value.