mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Start implementing inception modules tests
This commit is contained in:
26
examples/inception_v3/tests/CMakeLists.txt
Normal file
26
examples/inception_v3/tests/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
find_package(GTest REQUIRED)
|
||||
include_directories(${GTEST_INCLUDE_DIRS})
|
||||
|
||||
file(GLOB_RECURSE TEST_SOURCES
|
||||
*.cpp
|
||||
)
|
||||
|
||||
add_executable(test_inception_v3
|
||||
EXCLUDE_FROM_ALL
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(test_inception_v3 PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CUDANet_INCLUDE_DIRS}
|
||||
${CUDAToolkit_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(test_inception_v3
|
||||
${GTEST_BOTH_LIBRARIES}
|
||||
${CUDANet_LIBRARY}
|
||||
CUDA::cudart
|
||||
inception_v3_lib
|
||||
)
|
||||
|
||||
add_test(NAME TestMain COMMAND test_inception_v3)
|
||||
43
examples/inception_v3/tests/test_basic_conv2d.cpp
Normal file
43
examples/inception_v3/tests/test_basic_conv2d.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <inception_v3.hpp>
|
||||
|
||||
class BasicConv2dTest : public ::testing::Test {
|
||||
protected:
|
||||
BasicConv2d *basic_conv2d;
|
||||
|
||||
shape2d inputShape;
|
||||
int inputChannels;
|
||||
int outputChannels;
|
||||
shape2d kernelSize;
|
||||
shape2d stride;
|
||||
shape2d padding;
|
||||
std::string prefix = "test";
|
||||
|
||||
float *d_input;
|
||||
float *d_output;
|
||||
|
||||
std::vector<float> input;
|
||||
std::vector<float> output;
|
||||
|
||||
std::vector<float> weights;
|
||||
std::vector<float> biases;
|
||||
|
||||
virtual void SetUp() override {
|
||||
basic_conv2d = nullptr;
|
||||
}
|
||||
|
||||
virtual void TearDown() override {
|
||||
// Clean up
|
||||
delete basic_conv2d;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(BasicConv2dTest, BasicConv2dTest1) {
|
||||
inputShape = {28, 28};
|
||||
inputChannels = 1;
|
||||
outputChannels = 32;
|
||||
kernelSize = {3, 3};
|
||||
stride = {1, 1};
|
||||
padding = {1, 1};
|
||||
};
|
||||
Reference in New Issue
Block a user