Skip to content

Commit fb593f0

Browse files
committed
feat: add adaptive_max_pool3d_backward base
1 parent cfea02e commit fb593f0

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#ifndef INFINI_OPS_BASE_ADAPTIVE_MAX_POOL3D_BACKWARD_H_
2+
#define INFINI_OPS_BASE_ADAPTIVE_MAX_POOL3D_BACKWARD_H_
3+
4+
#include "operator.h"
5+
6+
namespace infini::ops {
7+
8+
class AdaptiveMaxPool3dBackward : public Operator<AdaptiveMaxPool3dBackward> {
9+
public:
10+
AdaptiveMaxPool3dBackward(const Tensor grad_output, const Tensor input,
11+
const Tensor indices, Tensor grad_input)
12+
: grad_output_shape_{grad_output.shape()},
13+
grad_output_strides_{grad_output.strides()},
14+
grad_output_type_{grad_output.dtype()},
15+
input_shape_{input.shape()},
16+
input_strides_{input.strides()},
17+
input_type_{input.dtype()},
18+
indices_shape_{indices.shape()},
19+
indices_strides_{indices.strides()},
20+
indices_type_{indices.dtype()},
21+
grad_input_shape_{grad_input.shape()},
22+
grad_input_strides_{grad_input.strides()},
23+
grad_input_type_{grad_input.dtype()},
24+
device_index_{grad_input.device().index()} {}
25+
26+
virtual void operator()(const Tensor grad_output, const Tensor input,
27+
const Tensor indices, Tensor grad_input) const = 0;
28+
29+
protected:
30+
Tensor::Shape grad_output_shape_;
31+
32+
Tensor::Strides grad_output_strides_;
33+
34+
DataType grad_output_type_;
35+
36+
Tensor::Shape input_shape_;
37+
38+
Tensor::Strides input_strides_;
39+
40+
DataType input_type_;
41+
42+
Tensor::Shape indices_shape_;
43+
44+
Tensor::Strides indices_strides_;
45+
46+
DataType indices_type_;
47+
48+
Tensor::Shape grad_input_shape_;
49+
50+
Tensor::Strides grad_input_strides_;
51+
52+
DataType grad_input_type_;
53+
54+
int device_index_{0};
55+
};
56+
57+
} // namespace infini::ops
58+
59+
#endif

0 commit comments

Comments
 (0)