Skip to content

Commit 675491e

Browse files
authored
feat: add max_unpool2d base (#332)
1 parent b0ab32e commit 675491e

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

src/base/max_unpool2d.h

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

0 commit comments

Comments
 (0)