Skip to content

Commit f852abe

Browse files
committed
feat: add prod base
1 parent cfea02e commit f852abe

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

src/base/prod.h

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

0 commit comments

Comments
 (0)