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