InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
float_power.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_FLOAT_POWER_H_
2#define INFINI_OPS_BASE_FLOAT_POWER_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class FloatPower : public Operator<FloatPower> {
9 public:
10 FloatPower(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 FloatPower(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 FloatPower(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 FloatPower(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 float_power.h:8
virtual void operator()(const Tensor input, const double exponent, Tensor out) const =0
double exponent_
Definition float_power.h:89
Tensor::Shape out_shape_
Definition float_power.h:83
FloatPower(const Tensor input, const Tensor exponent, Tensor out)
Definition float_power.h:10
DataType input_type_
Definition float_power.h:75
FloatPower(const Tensor input, const double exponent, Tensor out)
Definition float_power.h:22
virtual void operator()(Tensor input, const Tensor exponent) const =0
FloatPower(Tensor input, const Tensor exponent)
Definition float_power.h:45
DataType out_type_
Definition float_power.h:87
int device_index_
Definition float_power.h:91
Tensor::Strides exponent_strides_
Definition float_power.h:79
Tensor::Strides out_strides_
Definition float_power.h:85
Tensor::Strides input_strides_
Definition float_power.h:73
virtual void operator()(Tensor input, const double exponent) const =0
Tensor::Shape exponent_shape_
Definition float_power.h:77
FloatPower(Tensor input, const double exponent)
Definition float_power.h:35
virtual void operator()(const Tensor input, const Tensor exponent, Tensor out) const =0
DataType exponent_type_
Definition float_power.h:81
Tensor::Shape input_shape_
Definition float_power.h:71
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8