mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Add Kernels namespace
This commit is contained in:
@@ -12,9 +12,9 @@ class Conv2dTest : public ::testing::Test {
|
||||
int inputChannels,
|
||||
int kernelSize,
|
||||
int stride,
|
||||
Padding padding,
|
||||
Layers::Padding padding,
|
||||
int numFilters,
|
||||
Activation activation,
|
||||
Layers::Activation activation,
|
||||
std::vector<float>& input,
|
||||
float* kernels,
|
||||
float*& d_input,
|
||||
@@ -65,9 +65,9 @@ TEST_F(Conv2dTest, SimpleTest) {
|
||||
int inputChannels = 1;
|
||||
int kernelSize = 2;
|
||||
int stride = 1;
|
||||
Padding padding = VALID;
|
||||
Layers::Padding padding = Layers::Padding::VALID;
|
||||
int numFilters = 1;
|
||||
Activation activation = LINEAR;
|
||||
Layers::Activation activation = Layers::Activation::NONE;
|
||||
|
||||
std::vector<float> input = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f,
|
||||
7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f,
|
||||
@@ -114,9 +114,9 @@ TEST_F(Conv2dTest, ComplexTest) {
|
||||
int inputChannels = 3;
|
||||
int kernelSize = 3;
|
||||
int stride = 1;
|
||||
Padding padding = SAME;
|
||||
Layers::Padding padding = Layers::Padding::SAME;
|
||||
int numFilters = 2;
|
||||
Activation activation = LINEAR;
|
||||
Layers::Activation activation = Layers::Activation::NONE;
|
||||
|
||||
// clang-format off
|
||||
std::vector<float> input = {
|
||||
|
||||
@@ -16,7 +16,7 @@ class DenseLayerTest : public ::testing::Test {
|
||||
float* biases,
|
||||
float*& d_input,
|
||||
float*& d_output,
|
||||
Activation activation
|
||||
Layers::Activation activation
|
||||
) {
|
||||
// Create Dense layer
|
||||
Layers::Dense denseLayer(inputSize, outputSize, activation);
|
||||
@@ -57,7 +57,9 @@ TEST_F(DenseLayerTest, Init) {
|
||||
int inputSize = i;
|
||||
int outputSize = j;
|
||||
|
||||
Layers::Dense denseLayer(inputSize, outputSize, SIGMOID);
|
||||
Layers::Dense denseLayer(
|
||||
inputSize, outputSize, Layers::Activation::SIGMOID
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +78,9 @@ TEST_F(DenseLayerTest, setWeights) {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
Layers::Dense denseLayer(inputSize, outputSize, SIGMOID);
|
||||
Layers::Dense denseLayer(
|
||||
inputSize, outputSize, Layers::Activation::SIGMOID
|
||||
);
|
||||
|
||||
denseLayer.setWeights(weights.data());
|
||||
}
|
||||
@@ -102,7 +106,7 @@ TEST_F(DenseLayerTest, ForwardUnitWeightMatrixLinear) {
|
||||
|
||||
Layers::Dense denseLayer = commonTestSetup(
|
||||
inputSize, outputSize, input, weights.data(), biases.data(), d_input,
|
||||
d_output, LINEAR
|
||||
d_output, Layers::Activation::NONE
|
||||
);
|
||||
denseLayer.forward(d_input, d_output);
|
||||
|
||||
@@ -142,7 +146,8 @@ TEST_F(DenseLayerTest, ForwardRandomWeightMatrixRelu) {
|
||||
float* d_output;
|
||||
|
||||
Layers::Dense denseLayer = commonTestSetup(
|
||||
inputSize, outputSize, input, weights.data(), biases.data(), d_input, d_output, RELU
|
||||
inputSize, outputSize, input, weights.data(), biases.data(), d_input,
|
||||
d_output, Layers::Activation::RELU
|
||||
);
|
||||
|
||||
denseLayer.forward(d_input, d_output);
|
||||
@@ -186,8 +191,8 @@ TEST_F(DenseLayerTest, ForwardRandomWeightMatrixSigmoid) {
|
||||
float* d_output;
|
||||
|
||||
Layers::Dense denseLayer = commonTestSetup(
|
||||
inputSize, outputSize, input, weights.data(), biases.data(), d_input, d_output,
|
||||
SIGMOID
|
||||
inputSize, outputSize, input, weights.data(), biases.data(), d_input,
|
||||
d_output, Layers::Activation::SIGMOID
|
||||
);
|
||||
|
||||
denseLayer.forward(d_input, d_output);
|
||||
|
||||
Reference in New Issue
Block a user