src/mlpack/tests/activation_functions_test.cpp
void CheckHardShrinkActivationCorrect(const arma::colvec input,
                                      const arma::colvec target)
{
  HardShrink<> hardshrink;

  // Test the activation function using the entire vector as input.
  arma::colvec activations;
  hardshrink.Forward(input, activations);
  for (size_t i = 0; i < activations.n_elem; i++)
  {
    BOOST_REQUIRE_CLOSE(activations.at(i), target.at(i), 1e-3);
  }
}
/**
 * Implementation of the Hard Shrink activation function test. The function is
 * implemented as Hard Shrink layer in the file hardshrink.hpp
 *
 * @param input Input data used for evaluating the Hard Shrink activation function.
 * @param target Target data used to evaluate the Hard Shrink activation.
 */
Implementation of the Hard Shrink activation function test. The function is
implemented as Hard Shrink layer in the file hardshrink.hpp

@param input Input data used for evaluating the Hard Shrink activation function.
@param target Target data used to evaluate the Hard Shrink activation.
Implementation of the Hard Shrink activation function test . The function is implemented as Hard Shrink layer in the file hardshrink . hpp @param input Input data used for evaluating the Hard Shrink activation function . @param target Target data used to evaluate the Hard Shrink activation .
void CheckHardShrinkActivationCorrect(const arma::colvec input,
                                      const arma::colvec target)
{
  HardShrink<> hardshrink;
  arma::colvec activations;
  hardshrink.Forward(input, activations);
  for (size_t i = 0; i < activations.n_elem; i++)
  {
    BOOST_REQUIRE_CLOSE(activations.at(i), target.at(i), 1e-3);
  }
}
void CheckHardShrinkActivationCorrect ( const arma :: colvec input , const arma :: colvec target ) { HardShrink < > hardshrink ; arma :: colvec activations ; hardshrink . Forward ( input , activations ) ; for ( size_t i = 0 ; i < activations . n_elem ; i ++ ) { BOOST_REQUIRE_CLOSE ( activations . at ( i ) , target . at ( i ) , 1e-3 ) ; } }
Implementation of the Hard Shrink activation function test.
Implementation of the Hard Shrink activation function test .
// Test the activation function using the entire vector as input.