mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Rename dim2d to shape2d
This commit is contained in:
@@ -25,13 +25,13 @@ __global__ void convolution(
|
||||
const float* __restrict__ d_kernel,
|
||||
const float* __restrict__ d_bias,
|
||||
float* __restrict__ d_output,
|
||||
const dim2d inputSize,
|
||||
const shape2d inputSize,
|
||||
const int nChannels,
|
||||
const dim2d paddingSize,
|
||||
const dim2d kernelSize,
|
||||
const dim2d stride,
|
||||
const shape2d paddingSize,
|
||||
const shape2d kernelSize,
|
||||
const shape2d stride,
|
||||
const int nFilters,
|
||||
const dim2d outputSize
|
||||
const shape2d outputSize
|
||||
);
|
||||
|
||||
} // namespace CUDANet::Kernels
|
||||
|
||||
@@ -9,23 +9,23 @@ namespace CUDANet::Kernels {
|
||||
__global__ void max_pooling(
|
||||
const float* __restrict__ d_input,
|
||||
float* __restrict__ d_output,
|
||||
const dim2d inputSize,
|
||||
const dim2d outputSize,
|
||||
const shape2d inputSize,
|
||||
const shape2d outputSize,
|
||||
const int nChannels,
|
||||
const dim2d poolingSize,
|
||||
const dim2d stride,
|
||||
const dim2d padding
|
||||
const shape2d poolingSize,
|
||||
const shape2d stride,
|
||||
const shape2d padding
|
||||
);
|
||||
|
||||
__global__ void avg_pooling(
|
||||
const float* __restrict__ d_input,
|
||||
float* __restrict__ d_output,
|
||||
const dim2d inputSize,
|
||||
const dim2d outputSize,
|
||||
const shape2d inputSize,
|
||||
const shape2d outputSize,
|
||||
const int nChannels,
|
||||
const dim2d poolingSize,
|
||||
const dim2d stride,
|
||||
const dim2d padding
|
||||
const shape2d poolingSize,
|
||||
const shape2d stride,
|
||||
const shape2d padding
|
||||
);
|
||||
|
||||
} // namespace CUDANet::Kernels
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace CUDANet::Layers {
|
||||
class AvgPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
public:
|
||||
AvgPooling2d(
|
||||
dim2d inputSize,
|
||||
shape2d inputSize,
|
||||
int nChannels,
|
||||
dim2d poolingSize,
|
||||
dim2d stride,
|
||||
dim2d padding,
|
||||
shape2d poolingSize,
|
||||
shape2d stride,
|
||||
shape2d padding,
|
||||
ActivationType activationType
|
||||
);
|
||||
~AvgPooling2d();
|
||||
@@ -34,16 +34,16 @@ class AvgPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
*/
|
||||
int getInputSize();
|
||||
|
||||
dim2d getOutputDims();
|
||||
shape2d getOutputDims();
|
||||
|
||||
private:
|
||||
dim2d inputSize;
|
||||
shape2d inputSize;
|
||||
int nChannels;
|
||||
dim2d poolingSize;
|
||||
dim2d stride;
|
||||
dim2d padding;
|
||||
shape2d poolingSize;
|
||||
shape2d stride;
|
||||
shape2d padding;
|
||||
|
||||
dim2d outputSize;
|
||||
shape2d outputSize;
|
||||
|
||||
float* d_output;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace CUDANet::Layers {
|
||||
|
||||
class BatchNorm2d : public WeightedLayer, public TwoDLayer {
|
||||
public:
|
||||
BatchNorm2d(dim2d inputSize, int inputChannels, float epsilon, ActivationType activationType);
|
||||
BatchNorm2d(shape2d inputSize, int inputChannels, float epsilon, ActivationType activationType);
|
||||
|
||||
~BatchNorm2d();
|
||||
|
||||
@@ -64,11 +64,11 @@ class BatchNorm2d : public WeightedLayer, public TwoDLayer {
|
||||
*/
|
||||
int getInputSize();
|
||||
|
||||
dim2d getOutputDims();
|
||||
shape2d getOutputDims();
|
||||
|
||||
private:
|
||||
|
||||
dim2d inputSize;
|
||||
shape2d inputSize;
|
||||
int inputChannels;
|
||||
|
||||
int gridSize;
|
||||
|
||||
@@ -28,12 +28,12 @@ class Conv2d : public WeightedLayer, public TwoDLayer {
|
||||
* 'SOFTMAX' or 'NONE')
|
||||
*/
|
||||
Conv2d(
|
||||
dim2d inputSize,
|
||||
shape2d inputSize,
|
||||
int inputChannels,
|
||||
dim2d kernelSize,
|
||||
dim2d stride,
|
||||
shape2d kernelSize,
|
||||
shape2d stride,
|
||||
int numFilters,
|
||||
dim2d paddingSize,
|
||||
shape2d paddingSize,
|
||||
ActivationType activationType
|
||||
);
|
||||
|
||||
@@ -98,24 +98,24 @@ class Conv2d : public WeightedLayer, public TwoDLayer {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
dim2d getPaddingSize() {
|
||||
shape2d getPaddingSize() {
|
||||
return paddingSize;
|
||||
}
|
||||
|
||||
dim2d getOutputDims();
|
||||
shape2d getOutputDims();
|
||||
|
||||
private:
|
||||
// Inputs
|
||||
dim2d inputSize;
|
||||
shape2d inputSize;
|
||||
int inputChannels;
|
||||
|
||||
// Outputs
|
||||
dim2d outputSize;
|
||||
shape2d outputSize;
|
||||
|
||||
// Kernel
|
||||
dim2d kernelSize;
|
||||
dim2d stride;
|
||||
dim2d paddingSize;
|
||||
shape2d kernelSize;
|
||||
shape2d stride;
|
||||
shape2d paddingSize;
|
||||
int numFilters;
|
||||
|
||||
// Kernels
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define CUDANET_SAME_PADDING(inputSize, kernelSize, stride) \
|
||||
((stride - 1) * inputSize - stride + kernelSize) / 2;
|
||||
|
||||
typedef std::pair<int, int> dim2d;
|
||||
typedef std::pair<int, int> shape2d;
|
||||
|
||||
namespace CUDANet::Layers {
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CUDANet::Layers {
|
||||
class TwoDLayer {
|
||||
|
||||
public:
|
||||
virtual dim2d getOutputDims() = 0;
|
||||
virtual shape2d getOutputDims() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace CUDANet::Layers {
|
||||
class MaxPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
public:
|
||||
MaxPooling2d(
|
||||
dim2d inputSize,
|
||||
shape2d inputSize,
|
||||
int nChannels,
|
||||
dim2d poolingSize,
|
||||
dim2d stride,
|
||||
dim2d padding,
|
||||
shape2d poolingSize,
|
||||
shape2d stride,
|
||||
shape2d padding,
|
||||
ActivationType activationType
|
||||
);
|
||||
~MaxPooling2d();
|
||||
@@ -34,16 +34,16 @@ class MaxPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
*/
|
||||
int getInputSize();
|
||||
|
||||
dim2d getOutputDims();
|
||||
shape2d getOutputDims();
|
||||
|
||||
private:
|
||||
dim2d inputSize;
|
||||
shape2d inputSize;
|
||||
int nChannels;
|
||||
dim2d poolingSize;
|
||||
dim2d stride;
|
||||
dim2d padding;
|
||||
shape2d poolingSize;
|
||||
shape2d stride;
|
||||
shape2d padding;
|
||||
|
||||
dim2d outputSize;
|
||||
shape2d outputSize;
|
||||
|
||||
float* d_output;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ struct TensorInfo {
|
||||
|
||||
class Model {
|
||||
public:
|
||||
Model(const dim2d inputSize, const int inputChannels, const int outputSize);
|
||||
Model(const shape2d inputSize, const int inputChannels, const int outputSize);
|
||||
Model(const Model& other);
|
||||
~Model();
|
||||
|
||||
@@ -43,7 +43,7 @@ class Model {
|
||||
Layers::Input* inputLayer;
|
||||
Layers::Output* outputLayer;
|
||||
|
||||
dim2d inputSize;
|
||||
shape2d inputSize;
|
||||
int inputChannels;
|
||||
|
||||
int outputSize;
|
||||
|
||||
Reference in New Issue
Block a user