InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
index_select.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_INDEX_SELECT_H_
2#define INFINI_OPS_BASE_INDEX_SELECT_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class IndexSelect : public Operator<IndexSelect> {
9 public:
10 IndexSelect(const Tensor input, const Tensor index, const int64_t dim,
11 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 out_shape_{out.shape()},
19 out_strides_{out.strides()},
20 out_type_{out.dtype()},
21 dim_{dim},
22 device_index_{out.device().index()} {}
23
24 virtual void operator()(const Tensor input, const Tensor index,
25 const int64_t dim, Tensor out) 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 index_shape_;
35
36 Tensor::Strides index_strides_;
37
38 DataType index_type_;
39
40 Tensor::Shape out_shape_;
41
42 Tensor::Strides out_strides_;
43
44 DataType out_type_;
45
46 int64_t dim_{};
47
49};
50
51} // namespace infini::ops
52
53#endif
Definition index_select.h:8
DataType index_type_
Definition index_select.h:38
DataType out_type_
Definition index_select.h:44
Tensor::Strides out_strides_
Definition index_select.h:42
Tensor::Strides input_strides_
Definition index_select.h:30
Tensor::Strides index_strides_
Definition index_select.h:36
IndexSelect(const Tensor input, const Tensor index, const int64_t dim, Tensor out)
Definition index_select.h:10
Tensor::Shape input_shape_
Definition index_select.h:28
Tensor::Shape out_shape_
Definition index_select.h:40
int64_t dim_
Definition index_select.h:46
int device_index_
Definition index_select.h:48
DataType input_type_
Definition index_select.h:32
Tensor::Shape index_shape_
Definition index_select.h:34
virtual void operator()(const Tensor input, const Tensor index, const int64_t dim, Tensor out) const =0
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8