src/mlpack/tests/ann_layer_test.cpp
BOOST_AUTO_TEST_CASE(SimpleLinearNoBiasLayerTest)
{
  arma::mat output, input, delta;
  LinearNoBias<> module(10, 10);
  module.Parameters().randu();
  module.Reset();

  // Test the Forward function.
  input = arma::zeros(10, 1);
  module.Forward(input, output);
  BOOST_REQUIRE_EQUAL(0, arma::accu(output));

  // Test the Backward function.
  module.Backward(input, input, delta);
  BOOST_REQUIRE_EQUAL(arma::accu(delta), 0);
}
/**
 * Simple linear no bias module test.
 */
Simple linear no bias module test.
Simple linear no bias module test .
BOOST_AUTO_TEST_CASE(SimpleLinearNoBiasLayerTest)
{
  arma::mat output, input, delta;
  LinearNoBias<> module(10, 10);
  module.Parameters().randu();
  module.Reset();
  input = arma::zeros(10, 1);
  module.Forward(input, output);
  BOOST_REQUIRE_EQUAL(0, arma::accu(output));
  module.Backward(input, input, delta);
  BOOST_REQUIRE_EQUAL(arma::accu(delta), 0);
}
BOOST_AUTO_TEST_CASE ( SimpleLinearNoBiasLayerTest ) { arma :: mat output , input , delta ; LinearNoBias < > module ( 10 , 10 ) ; module . Parameters ( ) . randu ( ) ; module . Reset ( ) ; input = arma :: zeros ( 10 , 1 ) ; module . Forward ( input , output ) ; BOOST_REQUIRE_EQUAL ( 0 , arma :: accu ( output ) ) ; module . Backward ( input , input , delta ) ; BOOST_REQUIRE_EQUAL ( arma :: accu ( delta ) , 0 ) ; }
Simple linear no bias module test.
Simple linear no bias module test .
// Test the Forward function. // Test the Backward function.