src/mlpack/tests/ann_layer_test.cpp
/**
 * Test that the functions that can modify and access the parameters of the
 * Subview layer work.
 */
Test that the functions that can modify and access the parameters of the
Subview layer work.
Test that the functions that can modify and access the parameters of the Subview layer work .
BOOST_AUTO_TEST_CASE(SubviewLayerParametersTest)
{
  Subview<> layer1(1, 2, 3, 4, 5);
  Subview<> layer2(1, 3, 4, 5, 6);
  BOOST_REQUIRE_EQUAL(layer1.InSize(), 1);
  BOOST_REQUIRE_EQUAL(layer1.BeginRow(), 2);
  BOOST_REQUIRE_EQUAL(layer1.EndRow(), 3);
  BOOST_REQUIRE_EQUAL(layer1.BeginCol(), 4);
  BOOST_REQUIRE_EQUAL(layer1.EndCol(), 5);
  layer1.BeginRow() = 3;
  layer1.EndRow() = 4;
  layer1.BeginCol() = 5;
  layer1.EndCol() = 6;
  BOOST_REQUIRE_EQUAL(layer1.InSize(), layer2.InSize());
  BOOST_REQUIRE_EQUAL(layer1.BeginRow(), layer2.BeginRow());
  BOOST_REQUIRE_EQUAL(layer1.EndRow(), layer2.EndRow());
  BOOST_REQUIRE_EQUAL(layer1.BeginCol(), layer2.BeginCol());
  BOOST_REQUIRE_EQUAL(layer1.EndCol(), layer2.EndCol());
}
BOOST_AUTO_TEST_CASE ( SubviewLayerParametersTest ) { Subview < > layer1 ( 1 , 2 , 3 , 4 , 5 ) ; Subview < > layer2 ( 1 , 3 , 4 , 5 , 6 ) ; BOOST_REQUIRE_EQUAL ( layer1 . InSize ( ) , 1 ) ; BOOST_REQUIRE_EQUAL ( layer1 . BeginRow ( ) , 2 ) ; BOOST_REQUIRE_EQUAL ( layer1 . EndRow ( ) , 3 ) ; BOOST_REQUIRE_EQUAL ( layer1 . BeginCol ( ) , 4 ) ; BOOST_REQUIRE_EQUAL ( layer1 . EndCol ( ) , 5 ) ; layer1 . BeginRow ( ) = 3 ; layer1 . EndRow ( ) = 4 ; layer1 . BeginCol ( ) = 5 ; layer1 . EndCol ( ) = 6 ; BOOST_REQUIRE_EQUAL ( layer1 . InSize ( ) , layer2 . InSize ( ) ) ; BOOST_REQUIRE_EQUAL ( layer1 . BeginRow ( ) , layer2 . BeginRow ( ) ) ; BOOST_REQUIRE_EQUAL ( layer1 . EndRow ( ) , layer2 . EndRow ( ) ) ; BOOST_REQUIRE_EQUAL ( layer1 . BeginCol ( ) , layer2 . BeginCol ( ) ) ; BOOST_REQUIRE_EQUAL ( layer1 . EndCol ( ) , layer2 . EndCol ( ) ) ; }
Test that the functions that can modify and access the parameters of the
 Subview layer work.
Test that the functions that can modify and access the parameters of the Subview layer work .
// Parameter order : inSize, beginRow, endRow, beginCol, endCol. // Make sure we can get the parameters correctly. // Now modify the parameters to match the second layer. // Now ensure all results are the same.