InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
special_round.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_SPECIAL_ROUND_H_
2#define INFINI_OPS_BASE_SPECIAL_ROUND_H_
3
4#include "operator.h"
5
6namespace infini::ops::special {
7
8class Round : public Operator<Round> {
9 public:
10 Round(const Tensor input, Tensor out)
11 : input_shape_{input.shape()},
12 input_strides_{input.strides()},
13 input_type_{input.dtype()},
14 out_shape_{out.shape()},
15 out_strides_{out.strides()},
16 out_type_{out.dtype()},
17 decimals_{0},
18 device_index_{out.device().index()} {}
19
22 [[deprecated("Use the `(input, out)` overload instead.")]]
23 Round(const Tensor input, const int64_t decimals, Tensor out)
24 : input_shape_{input.shape()},
25 input_strides_{input.strides()},
26 input_type_{input.dtype()},
27 out_shape_{out.shape()},
28 out_strides_{out.strides()},
29 out_type_{out.dtype()},
30 decimals_{decimals},
31 device_index_{out.device().index()} {}
32
33 void operator()(const Tensor input, Tensor out) const {
34 (*this)(input, 0, out);
35 }
36
39 [[deprecated("Use the `(input, out)` overload instead.")]]
40 virtual void operator()(const Tensor input, const int64_t decimals,
41 Tensor out) const = 0;
42
43 protected:
44 Tensor::Shape input_shape_;
45
46 Tensor::Strides input_strides_;
47
48 DataType input_type_;
49
50 Tensor::Shape out_shape_;
51
52 Tensor::Strides out_strides_;
53
54 DataType out_type_;
55
56 int64_t decimals_{};
57
59};
60
61} // namespace infini::ops::special
62
63#endif
Definition generated/include/operator.h:282
Definition special_round.h:8
void operator()(const Tensor input, Tensor out) const
Definition special_round.h:33
Tensor::Strides input_strides_
Definition special_round.h:46
int64_t decimals_
Definition special_round.h:56
Tensor::Shape out_shape_
Definition special_round.h:50
Round(const Tensor input, const int64_t decimals, Tensor out)
Definition special_round.h:23
DataType input_type_
Definition special_round.h:48
virtual void operator()(const Tensor input, const int64_t decimals, Tensor out) const =0
DataType out_type_
Definition special_round.h:54
Round(const Tensor input, Tensor out)
Definition special_round.h:10
int device_index_
Definition special_round.h:58
Tensor::Strides out_strides_
Definition special_round.h:52
Tensor::Shape input_shape_
Definition special_round.h:44
Definition special_airy_ai.h:6
infini::rt::TensorView Tensor
Definition tensor.h:8