mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-12-22 14:24:22 +00:00
WIP Migrate AvgPool2d
This commit is contained in:
55
include/layers/avg_pool.hpp
Normal file
55
include/layers/avg_pool.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "layer.hpp"
|
||||
|
||||
namespace CUDANet::Layers {
|
||||
|
||||
class AvgPool2d : public Layer {
|
||||
public:
|
||||
AvgPool2d(
|
||||
CUDANet::Shape input_shape,
|
||||
CUDANet::Shape pool_shape,
|
||||
CUDANet::Shape stride_shape,
|
||||
CUDANet::Shape padding_shape,
|
||||
CUDANet::Backend *backend
|
||||
);
|
||||
|
||||
~AvgPool2d();
|
||||
|
||||
CUDANet::Tensor& forward(CUDANet::Tensor& input) override;
|
||||
|
||||
CUDANet::Shape input_shape() override;
|
||||
|
||||
CUDANet::Shape output_shape() override;
|
||||
|
||||
size_t input_size() override;
|
||||
|
||||
size_t output_size() override;
|
||||
|
||||
void set_weights(void* input) override;
|
||||
|
||||
CUDANet::Tensor& get_weights() override;
|
||||
|
||||
void set_biases(void* input) override;
|
||||
|
||||
CUDANet::Tensor& get_biases() override;
|
||||
|
||||
protected:
|
||||
CUDANet::Shape in_shape;
|
||||
|
||||
CUDANet::Shape pool_shape;
|
||||
CUDANet::Shape stride_shape;
|
||||
CUDANet::Shape padding_shape;
|
||||
|
||||
CUDANet::Shape out_shape;
|
||||
CUDANet::Tensor output;
|
||||
|
||||
CUDANet::Backend *backend;
|
||||
};
|
||||
|
||||
class AdaptiveAvgPool2d : public AvgPool2d {
|
||||
public:
|
||||
AdaptiveAvgPool2d(CUDANet::Shape input_shape, CUDANet::Shape output_shape, CUDANet::Backend *backend);
|
||||
};
|
||||
|
||||
} // namespace CUDANet::Layers
|
||||
Reference in New Issue
Block a user