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