WIP Migrate AvgPool2d

This commit is contained in:
2025-11-19 23:21:18 +01:00
parent e4d05931d4
commit 6685aa6629
5 changed files with 141 additions and 162 deletions

View 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