InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
where.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_WHERE_H_
2#define INFINI_OPS_BASE_WHERE_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Where : public Operator<Where> {
9 public:
10 Where(const Tensor condition, const Tensor input, const Tensor other,
11 Tensor out)
12 : condition_shape_{condition.shape()},
13 condition_strides_{condition.strides()},
14 condition_type_{condition.dtype()},
15 input_shape_{input.shape()},
16 input_strides_{input.strides()},
17 input_type_{input.dtype()},
18 other_shape_{other.shape()},
19 other_strides_{other.strides()},
20 other_type_{other.dtype()},
21 out_shape_{out.shape()},
22 out_strides_{out.strides()},
23 out_type_{out.dtype()},
24 device_index_{out.device().index()} {}
25
26 virtual void operator()(const Tensor condition, const Tensor input,
27 const Tensor other, Tensor out) const = 0;
28
29 protected:
30 Tensor::Shape condition_shape_;
31
32 Tensor::Strides condition_strides_;
33
35
36 Tensor::Shape input_shape_;
37
38 Tensor::Strides input_strides_;
39
40 DataType input_type_;
41
42 Tensor::Shape other_shape_;
43
44 Tensor::Strides other_strides_;
45
46 DataType other_type_;
47
48 Tensor::Shape out_shape_;
49
50 Tensor::Strides out_strides_;
51
52 DataType out_type_;
53
55};
56
57} // namespace infini::ops
58
59#endif
Definition generated/include/operator.h:282
Definition where.h:8
Tensor::Strides out_strides_
Definition where.h:50
Tensor::Shape condition_shape_
Definition where.h:30
DataType input_type_
Definition where.h:40
DataType other_type_
Definition where.h:46
Tensor::Strides other_strides_
Definition where.h:44
Tensor::Shape out_shape_
Definition where.h:48
DataType condition_type_
Definition where.h:34
Tensor::Strides input_strides_
Definition where.h:38
Where(const Tensor condition, const Tensor input, const Tensor other, Tensor out)
Definition where.h:10
Tensor::Shape input_shape_
Definition where.h:36
int device_index_
Definition where.h:54
Tensor::Shape other_shape_
Definition where.h:42
Tensor::Strides condition_strides_
Definition where.h:32
DataType out_type_
Definition where.h:52
virtual void operator()(const Tensor condition, const Tensor input, const Tensor other, Tensor out) const =0
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8