InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
index_add.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_INDEX_ADD_H_
2#define INFINI_OPS_BASE_INDEX_ADD_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class IndexAdd : public Operator<IndexAdd> {
9 public:
10 IndexAdd(const Tensor input, const Tensor index, const Tensor source,
11 const int64_t dim, const double alpha, 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 source_shape_{source.shape()},
19 source_strides_{source.strides()},
20 source_type_{source.dtype()},
21 out_shape_{out.shape()},
22 out_strides_{out.strides()},
23 out_type_{out.dtype()},
24 dim_{dim},
25 alpha_{alpha},
26 device_index_{out.device().index()} {}
27
28 virtual void operator()(const Tensor input, const Tensor index,
29 const Tensor source, const int64_t dim,
30 const double alpha, Tensor out) const = 0;
31
32 protected:
33 Tensor::Shape input_shape_;
34
35 Tensor::Strides input_strides_;
36
37 DataType input_type_;
38
39 Tensor::Shape index_shape_;
40
41 Tensor::Strides index_strides_;
42
43 DataType index_type_;
44
45 Tensor::Shape source_shape_;
46
47 Tensor::Strides source_strides_;
48
49 DataType source_type_;
50
51 Tensor::Shape out_shape_;
52
53 Tensor::Strides out_strides_;
54
55 DataType out_type_;
56
57 int64_t dim_{};
58
59 double alpha_{};
60
62};
63
64} // namespace infini::ops
65
66#endif
Definition index_add.h:8
DataType out_type_
Definition index_add.h:55
DataType index_type_
Definition index_add.h:43
Tensor::Shape index_shape_
Definition index_add.h:39
DataType source_type_
Definition index_add.h:49
Tensor::Strides index_strides_
Definition index_add.h:41
double alpha_
Definition index_add.h:59
Tensor::Shape input_shape_
Definition index_add.h:33
virtual void operator()(const Tensor input, const Tensor index, const Tensor source, const int64_t dim, const double alpha, Tensor out) const =0
int64_t dim_
Definition index_add.h:57
DataType input_type_
Definition index_add.h:37
Tensor::Shape out_shape_
Definition index_add.h:51
Tensor::Strides out_strides_
Definition index_add.h:53
Tensor::Strides input_strides_
Definition index_add.h:35
IndexAdd(const Tensor input, const Tensor index, const Tensor source, const int64_t dim, const double alpha, Tensor out)
Definition index_add.h:10
Tensor::Shape source_shape_
Definition index_add.h:45
int device_index_
Definition index_add.h:61
Tensor::Strides source_strides_
Definition index_add.h:47
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8