Skip to content

Commit 38f629b

Browse files
committed
feat: add nanmedian base
1 parent 78424f7 commit 38f629b

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

src/base/nanmedian.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// AUTO-GENERATED by `scripts/generate_torch_ops.py` — DO NOT EDIT.
2+
#ifndef INFINI_OPS_BASE_NANMEDIAN_H_
3+
#define INFINI_OPS_BASE_NANMEDIAN_H_
4+
5+
#include "operator.h"
6+
7+
namespace infini::ops {
8+
9+
class Nanmedian : public Operator<Nanmedian> {
10+
public:
11+
Nanmedian(const Tensor input, const int64_t dim, const bool keepdim, Tensor values, Tensor indices)
12+
: input_shape_{input.shape()},
13+
input_strides_{input.strides()},
14+
input_type_{input.dtype()},
15+
values_shape_{values.shape()},
16+
values_strides_{values.strides()},
17+
values_type_{values.dtype()},
18+
indices_shape_{indices.shape()},
19+
indices_strides_{indices.strides()},
20+
indices_type_{indices.dtype()},
21+
dim_{dim},
22+
keepdim_{keepdim},
23+
device_index_{values.device().index()} {}
24+
25+
virtual void operator()(const Tensor input, const int64_t dim, const bool keepdim, Tensor values, Tensor indices) const = 0;
26+
27+
protected:
28+
Tensor::Shape input_shape_;
29+
30+
Tensor::Strides input_strides_;
31+
32+
DataType input_type_;
33+
34+
Tensor::Shape values_shape_;
35+
36+
Tensor::Strides values_strides_;
37+
38+
DataType values_type_;
39+
40+
Tensor::Shape indices_shape_;
41+
42+
Tensor::Strides indices_strides_;
43+
44+
DataType indices_type_;
45+
46+
int64_t dim_{};
47+
48+
bool keepdim_{};
49+
50+
int device_index_{0};
51+
};
52+
53+
} // namespace infini::ops
54+
55+
#endif

0 commit comments

Comments
 (0)