mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 09:44:28 +00:00
Set up basic tests with gtest
This commit is contained in:
24
test/layers/test_dense.cpp
Normal file
24
test/layers/test_dense.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "dense.h"
|
||||
#include "test_cublas_fixture.h"
|
||||
|
||||
class DenseLayerTest : public CublasTestFixture {
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
TEST_F(DenseLayerTest, Forward) {
|
||||
|
||||
Layers::Dense denseLayer(3, 2, cublasHandle);
|
||||
|
||||
// Create input and output arrays
|
||||
float input[3] = {1.0f, 2.0f, 3.0f};
|
||||
float output[2] = {0.0f, 0.0f};
|
||||
|
||||
// Perform forward pass
|
||||
denseLayer.forward(input, output);
|
||||
|
||||
// Check if the output is a zero vector
|
||||
EXPECT_FLOAT_EQ(output[0], 0.0f);
|
||||
EXPECT_FLOAT_EQ(output[1], 0.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user