Skip to content

Commit 3634a2c

Browse files
authored
feat: add max_unpool3d base (#333)
1 parent bf4d338 commit 3634a2c

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

src/base/max_unpool3d.h

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

0 commit comments

Comments
 (0)