MachineIntelligenceCore:NeuralNets
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
SoftmaxTests.hpp
Go to the documentation of this file.
1 
25 #ifndef SOFTMAXTESTS_HPP_
26 #define SOFTMAXTESTS_HPP_
27 
28 #include <gtest/gtest.h>
29 
30 // Redefine word "public" so every class field/method will be accessible for tests.
31 #define private public
32 #define protected public
35 
40 class Softmax4x1Float : public ::testing::Test {
41 public:
42  // Constructor. Sets layer size.
44  input_x = MAKE_MATRIX_PTR(float, 4, 1);
45  output_y = MAKE_MATRIX_PTR(float, 4, 1);
46  target_y = MAKE_MATRIX_PTR(float, 4, 1);
47  }
48 
49 protected:
50  // Sets test values.
51  virtual void SetUp() {
52  (*input_x) << 1, -1, -5, 0.5;
53  (*output_y) << 0.573281, 0.0775852, 0.00142102, 0.347713;
54  (*target_y) << 0.5, 0.25, 0.15, 0.10;
55  }
56 
57 private:
58  // Object to be tested.
60 
61  // Test input x - used in forward pass.
62  mic::types::MatrixPtr<float> input_x;
63 
64  // Output y values.
65  mic::types::MatrixPtr<float> output_y;
66 
67  // Target y values.
68  mic::types::MatrixPtr<float> target_y;
69 };
70 
71 
72 
73 #endif /* SOFTMAXTESTS_HPP_ */
Test Fixture - 4x1 softmax layer.
mic::types::MatrixPtr< float > output_y
mic::types::MatrixPtr< float > target_y
virtual void SetUp()
mic::mlnn::cost_function::Softmax< float > layer
mic::types::MatrixPtr< float > input_x