|
| 1 | +#ifndef INFINI_OPS_BASE_AVG_POOL3D_BACKWARD_GRAD_INPUT_H_ |
| 2 | +#define INFINI_OPS_BASE_AVG_POOL3D_BACKWARD_GRAD_INPUT_H_ |
| 3 | + |
| 4 | +#include "operator.h" |
| 5 | + |
| 6 | +namespace infini::ops { |
| 7 | + |
| 8 | +class AvgPool3dBackwardGradInput : public Operator<AvgPool3dBackwardGradInput> { |
| 9 | + public: |
| 10 | + AvgPool3dBackwardGradInput(const Tensor grad_output, const Tensor self, |
| 11 | + const std::vector<int64_t> kernel_size, |
| 12 | + const std::vector<int64_t> stride, |
| 13 | + const std::vector<int64_t> padding, |
| 14 | + const bool ceil_mode, const bool count_include_pad, |
| 15 | + Tensor grad_input) |
| 16 | + : grad_output_shape_{grad_output.shape()}, |
| 17 | + grad_output_strides_{grad_output.strides()}, |
| 18 | + grad_output_type_{grad_output.dtype()}, |
| 19 | + self_shape_{self.shape()}, |
| 20 | + self_strides_{self.strides()}, |
| 21 | + self_type_{self.dtype()}, |
| 22 | + grad_input_shape_{grad_input.shape()}, |
| 23 | + grad_input_strides_{grad_input.strides()}, |
| 24 | + grad_input_type_{grad_input.dtype()}, |
| 25 | + device_index_{grad_input.device().index()} {} |
| 26 | + |
| 27 | + virtual void operator()(const Tensor grad_output, const Tensor self, |
| 28 | + const std::vector<int64_t> kernel_size, |
| 29 | + const std::vector<int64_t> stride, |
| 30 | + const std::vector<int64_t> padding, |
| 31 | + const bool ceil_mode, const bool count_include_pad, |
| 32 | + Tensor grad_input) const = 0; |
| 33 | + |
| 34 | + protected: |
| 35 | + Tensor::Shape grad_output_shape_; |
| 36 | + Tensor::Strides grad_output_strides_; |
| 37 | + DataType grad_output_type_; |
| 38 | + Tensor::Shape self_shape_; |
| 39 | + Tensor::Strides self_strides_; |
| 40 | + DataType self_type_; |
| 41 | + Tensor::Shape grad_input_shape_; |
| 42 | + Tensor::Strides grad_input_strides_; |
| 43 | + DataType grad_input_type_; |
| 44 | + int device_index_{0}; |
| 45 | +}; |
| 46 | + |
| 47 | +} // namespace infini::ops |
| 48 | + |
| 49 | +#endif |
0 commit comments