diff --git a/src/mlpack/tests/feedforward_network_test.cpp b/src/mlpack/tests/feedforward_network_test.cpp index 7188f69f50..d828bb4075 100644 --- a/src/mlpack/tests/feedforward_network_test.cpp +++ b/src/mlpack/tests/feedforward_network_test.cpp @@ -153,6 +153,41 @@ TEST_CASE("CheckCopyMovingVanillaNetworkTest", "[FeedForwardNetworkTest]") CheckMoveFunction<>(model1, trainData, trainLabels, 1); } +/** + * Noisy Linear layer constructor test. + */ +TEST_CASE("CheckCopyMovingNoisyLinearTest", "[FeedForwardNetworkTest]") +{ + // Create training input by 5x5 matrix + arma::mat input = arma::randu(10,1); + // Create training output by 1 matrix + arma::mat output = arma::mat("1"); + + // Check copying constructor + FFN> *model1 = new FFN>(); + model1->Predictors() = input; + model1->Responses() = output; + model1->Add>(); + model1->Add>(10, 5); + model1->Add >(5, 1); + model1->Add>(); + + // Check whether copy constructor is working or not. + CheckCopyFunction<>(model1, input, output, 1); + + // Check moving constructor + FFN> *model2 = new FFN>(); + model2->Predictors() = input; + model2->Responses() = output; + model2->Add>(); + model2->Add>(10, 5); + model2->Add >(5, 1); + model2->Add>(); + + // Check whether move constructor is working or not. + CheckMoveFunction<>(model2, input, output, 1); +} + /** * Train the vanilla network on a larger dataset. */