Skip to content

Commit a58ecc5

Browse files
authored
feat: add reflection_pad1d base (#386)
1 parent 5d59a35 commit a58ecc5

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

src/base/reflection_pad1d.h

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

0 commit comments

Comments
 (0)