InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
aminmax.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_AMINMAX_H_
2#define INFINI_OPS_BASE_AMINMAX_H_
3
4#include <optional>
5
6#include "operator.h"
7
8namespace infini::ops {
9
10class Aminmax : public Operator<Aminmax> {
11 public:
12 Aminmax(const Tensor input, const std::optional<int64_t> dim,
13 const bool keepdim, Tensor min, Tensor max)
14 : input_shape_{input.shape()},
15 input_strides_{input.strides()},
16 input_type_{input.dtype()},
17 min_shape_{min.shape()},
18 min_strides_{min.strides()},
19 min_type_{min.dtype()},
20 max_shape_{max.shape()},
21 max_strides_{max.strides()},
22 max_type_{max.dtype()},
23 dim_{dim},
24 keepdim_{keepdim},
25 device_index_{min.device().index()} {}
26
27 virtual void operator()(const Tensor input, const std::optional<int64_t> dim,
28 const bool keepdim, Tensor min, Tensor max) const = 0;
29
30 protected:
31 Tensor::Shape input_shape_;
32
33 Tensor::Strides input_strides_;
34
35 DataType input_type_;
36
37 Tensor::Shape min_shape_;
38
39 Tensor::Strides min_strides_;
40
41 DataType min_type_;
42
43 Tensor::Shape max_shape_;
44
45 Tensor::Strides max_strides_;
46
47 DataType max_type_;
48
49 std::optional<int64_t> dim_{};
50
51 bool keepdim_{};
52
54};
55
56} // namespace infini::ops
57
58#endif
Definition aminmax.h:10
Tensor::Strides max_strides_
Definition aminmax.h:45
Tensor::Shape input_shape_
Definition aminmax.h:31
Aminmax(const Tensor input, const std::optional< int64_t > dim, const bool keepdim, Tensor min, Tensor max)
Definition aminmax.h:12
DataType max_type_
Definition aminmax.h:47
Tensor::Shape max_shape_
Definition aminmax.h:43
int device_index_
Definition aminmax.h:53
Tensor::Strides input_strides_
Definition aminmax.h:33
bool keepdim_
Definition aminmax.h:51
virtual void operator()(const Tensor input, const std::optional< int64_t > dim, const bool keepdim, Tensor min, Tensor max) const =0
std::optional< int64_t > dim_
Definition aminmax.h:49
Tensor::Strides min_strides_
Definition aminmax.h:39
DataType input_type_
Definition aminmax.h:35
DataType min_type_
Definition aminmax.h:41
Tensor::Shape min_shape_
Definition aminmax.h:37
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8