InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
pow.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_POW_H_
2#define INFINI_OPS_BASE_POW_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Pow : public Operator<Pow> {
9 public:
10 Pow(const Tensor input, const Tensor exponent, Tensor out)
11 : input_shape_{input.shape()},
12 input_strides_{input.strides()},
13 input_type_{input.dtype()},
14 exponent_shape_{exponent.shape()},
15 exponent_strides_{exponent.strides()},
16 exponent_type_{exponent.dtype()},
17 out_shape_{out.shape()},
18 out_strides_{out.strides()},
19 out_type_{out.dtype()},
20 device_index_{out.device().index()} {}
21
22 Pow(const Tensor input, const double exponent, Tensor out)
23 : input_shape_{input.shape()},
24 input_strides_{input.strides()},
25 input_type_{input.dtype()},
26 out_shape_{out.shape()},
27 out_strides_{out.strides()},
28 out_type_{out.dtype()},
29 exponent_{exponent},
30 device_index_{out.device().index()} {}
31
34 [[deprecated("Use the explicit-output overload instead.")]]
35 Pow(Tensor input, const double exponent)
36 : input_shape_{input.shape()},
37 input_strides_{input.strides()},
38 input_type_{input.dtype()},
39 exponent_{exponent},
40 device_index_{input.device().index()} {}
41
44 [[deprecated("Use the explicit-output overload instead.")]]
45 Pow(Tensor input, const Tensor exponent)
46 : input_shape_{input.shape()},
47 input_strides_{input.strides()},
48 input_type_{input.dtype()},
49 exponent_shape_{exponent.shape()},
50 exponent_strides_{exponent.strides()},
51 exponent_type_{exponent.dtype()},
52 device_index_{input.device().index()} {}
53
54 virtual void operator()(const Tensor input, const Tensor exponent,
55 Tensor out) const = 0;
56
57 virtual void operator()(const Tensor input, const double exponent,
58 Tensor out) const = 0;
59
62 [[deprecated("Use an explicit-output overload instead.")]]
63 virtual void operator()(Tensor input, const double exponent) const = 0;
64
67 [[deprecated("Use an explicit-output overload instead.")]]
68 virtual void operator()(Tensor input, const Tensor exponent) const = 0;
69
70 protected:
71 Tensor::Shape input_shape_;
72
73 Tensor::Strides input_strides_;
74
75 DataType input_type_;
76
77 Tensor::Shape exponent_shape_;
78
79 Tensor::Strides exponent_strides_;
80
82
83 Tensor::Shape out_shape_;
84
85 Tensor::Strides out_strides_;
86
87 DataType out_type_;
88
89 double exponent_{};
90
92};
93
94} // namespace infini::ops
95
96#endif
Definition generated/include/operator.h:282
Definition pow.h:8
DataType input_type_
Definition pow.h:75
Tensor::Strides exponent_strides_
Definition pow.h:79
Pow(const Tensor input, const Tensor exponent, Tensor out)
Definition pow.h:10
virtual void operator()(Tensor input, const Tensor exponent) const =0
Pow(Tensor input, const double exponent)
Definition pow.h:35
DataType exponent_type_
Definition pow.h:81
virtual void operator()(const Tensor input, const double exponent, Tensor out) const =0
Tensor::Shape out_shape_
Definition pow.h:83
double exponent_
Definition pow.h:89
virtual void operator()(Tensor input, const double exponent) const =0
Tensor::Shape exponent_shape_
Definition pow.h:77
Tensor::Shape input_shape_
Definition pow.h:71
int device_index_
Definition pow.h:91
Tensor::Strides input_strides_
Definition pow.h:73
Pow(const Tensor input, const double exponent, Tensor out)
Definition pow.h:22
virtual void operator()(const Tensor input, const Tensor exponent, Tensor out) const =0
Tensor::Strides out_strides_
Definition pow.h:85
DataType out_type_
Definition pow.h:87
Pow(Tensor input, const Tensor exponent)
Definition pow.h:45
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8