mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 09:44:28 +00:00
Implement simple input layer
This commit is contained in:
@@ -4,6 +4,7 @@ include_directories(${GTEST_INCLUDE_DIRS})
|
||||
add_executable(test_main
|
||||
layers/test_dense.cu
|
||||
layers/test_conv2d.cu
|
||||
layers/test_input.cu
|
||||
kernels/test_activations.cu
|
||||
kernels/test_padding.cu
|
||||
)
|
||||
|
||||
16
test/layers/test_input.cu
Normal file
16
test/layers/test_input.cu
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "input.cuh"
|
||||
#include "cuda_helper.cuh"
|
||||
|
||||
|
||||
TEST(InputLayerTest, Init) {
|
||||
std::vector<float> input = {0.573f, 0.619f, 0.732f, 0.055f, 0.243f, 0.316f};
|
||||
Layers::Input inputLayer(6);
|
||||
float* d_output = inputLayer.forward(input.data());
|
||||
|
||||
std::vector<float> output(6);
|
||||
CUDA_CHECK(cudaMemcpy(output.data(), d_output, sizeof(float) * 6, cudaMemcpyDeviceToHost));
|
||||
EXPECT_EQ(input, output);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user