src/mlpack/tests/ann_layer_test.cpp
BOOST_AUTO_TEST_CASE(WeightNormRunTest)
{
  arma::mat output, input, delta, error;

  Linear<>* linear = new Linear<>(10, 10);

  WeightNorm<> module(linear);

  module.Parameters().randu();
  module.Reset();

  linear->Bias().zeros();

  input = arma::zeros(10, 1);
  module.Forward(input, output);

  // Test the Backward function.
  module.Backward(input, input, delta);

  BOOST_REQUIRE_EQUAL(0, arma::accu(output));
  BOOST_REQUIRE_EQUAL(arma::accu(delta), 0);
}
/**
 * Test if the WeightNorm layer is able to forward the
 * Forward/Backward/Gradient calls.
 */
Test if the WeightNorm layer is able to forward the
Forward/Backward/Gradient calls.
Test if the WeightNorm layer is able to forward the Forward / Backward / Gradient calls .
BOOST_AUTO_TEST_CASE(WeightNormRunTest)
{
  arma::mat output, input, delta, error;
  Linear<>* linear = new Linear<>(10, 10);
  WeightNorm<> module(linear);
  module.Parameters().randu();
  module.Reset();
  linear->Bias().zeros();
  input = arma::zeros(10, 1);
  module.Forward(input, output);
  module.Backward(input, input, delta);
  BOOST_REQUIRE_EQUAL(0, arma::accu(output));
  BOOST_REQUIRE_EQUAL(arma::accu(delta), 0);
}
BOOST_AUTO_TEST_CASE ( WeightNormRunTest ) { arma :: mat output , input , delta , error ; Linear < > * linear = new Linear < > ( 10 , 10 ) ; WeightNorm < > module ( linear ) ; module . Parameters ( ) . randu ( ) ; module . Reset ( ) ; linear -> Bias ( ) . zeros ( ) ; input = arma :: zeros ( 10 , 1 ) ; module . Forward ( input , output ) ; module . Backward ( input , input , delta ) ; BOOST_REQUIRE_EQUAL ( 0 , arma :: accu ( output ) ) ; BOOST_REQUIRE_EQUAL ( arma :: accu ( delta ) , 0 ) ; }
Test if the WeightNorm layer is able to forward the
 Forward/Backward/Gradient calls.
Test if the WeightNorm layer is able to forward the Forward / Backward / Gradient calls .
// Test the Backward function.