InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
index_fill.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_INDEX_FILL_H_
2#define INFINI_OPS_BASE_INDEX_FILL_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class IndexFill : public Operator<IndexFill> {
9 public:
10 IndexFill(const Tensor input, const Tensor index, const double value,
11 const int64_t dim, Tensor out)
12 : input_shape_{input.shape()},
13 input_strides_{input.strides()},
14 input_type_{input.dtype()},
15 index_shape_{index.shape()},
16 index_strides_{index.strides()},
17 index_type_{index.dtype()},
18 dim_{dim},
19 value_{value},
20 out_shape_{out.shape()},
21 out_strides_{out.strides()},
22 out_type_{out.dtype()},
23 device_index_{out.device().index()} {}
24
25 IndexFill(const Tensor input, const Tensor index, const Tensor value,
26 const int64_t dim, Tensor out)
27 : input_shape_{input.shape()},
28 input_strides_{input.strides()},
29 input_type_{input.dtype()},
30 index_shape_{index.shape()},
31 index_strides_{index.strides()},
32 index_type_{index.dtype()},
33 dim_{dim},
34 value_shape_{value.shape()},
35 value_strides_{value.strides()},
36 value_type_{value.dtype()},
37 out_shape_{out.shape()},
38 out_strides_{out.strides()},
39 out_type_{out.dtype()},
40 device_index_{out.device().index()} {}
41
42 virtual void operator()(const Tensor input, const Tensor index,
43 const double value, const int64_t dim,
44 Tensor out) const = 0;
45
46 virtual void operator()(const Tensor input, const Tensor index,
47 const Tensor value, const int64_t dim,
48 Tensor out) const = 0;
49
50 protected:
51 Tensor::Shape input_shape_;
52
53 Tensor::Strides input_strides_;
54
55 DataType input_type_;
56
57 Tensor::Shape index_shape_;
58
59 Tensor::Strides index_strides_;
60
61 DataType index_type_;
62
63 int64_t dim_{};
64
65 double value_{};
66
67 Tensor::Shape value_shape_;
68
69 Tensor::Strides value_strides_;
70
71 DataType value_type_;
72
73 Tensor::Shape out_shape_;
74
75 Tensor::Strides out_strides_;
76
77 DataType out_type_;
78
80};
81
82} // namespace infini::ops
83
84#endif
Definition index_fill.h:8
IndexFill(const Tensor input, const Tensor index, const Tensor value, const int64_t dim, Tensor out)
Definition index_fill.h:25
int device_index_
Definition index_fill.h:79
virtual void operator()(const Tensor input, const Tensor index, const Tensor value, const int64_t dim, Tensor out) const =0
DataType value_type_
Definition index_fill.h:71
Tensor::Strides value_strides_
Definition index_fill.h:69
DataType input_type_
Definition index_fill.h:55
virtual void operator()(const Tensor input, const Tensor index, const double value, const int64_t dim, Tensor out) const =0
Tensor::Shape out_shape_
Definition index_fill.h:73
DataType out_type_
Definition index_fill.h:77
Tensor::Shape index_shape_
Definition index_fill.h:57
Tensor::Strides out_strides_
Definition index_fill.h:75
Tensor::Shape input_shape_
Definition index_fill.h:51
Tensor::Strides index_strides_
Definition index_fill.h:59
Tensor::Shape value_shape_
Definition index_fill.h:67
int64_t dim_
Definition index_fill.h:63
double value_
Definition index_fill.h:65
Tensor::Strides input_strides_
Definition index_fill.h:53
DataType index_type_
Definition index_fill.h:61
IndexFill(const Tensor input, const Tensor index, const double value, const int64_t dim, Tensor out)
Definition index_fill.h:10
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8