InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
max.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_MAX_H_
2#define INFINI_OPS_BASE_MAX_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Max : public Operator<Max> {
9 public:
10 Max(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
22 Max(const Tensor input, const int64_t dim, const bool keepdim, Tensor max,
23 Tensor max_values)
24 : input_shape_{input.shape()},
25 input_strides_{input.strides()},
26 input_type_{input.dtype()},
27 max_shape_{max.shape()},
28 max_strides_{max.strides()},
29 max_type_{max.dtype()},
30 max_values_shape_{max_values.shape()},
31 max_values_strides_{max_values.strides()},
32 max_values_type_{max_values.dtype()},
33 dim_{dim},
34 keepdim_{keepdim},
35 device_index_{max.device().index()} {}
36
37 Max(const Tensor input, Tensor out)
38 : input_shape_{input.shape()},
39 input_strides_{input.strides()},
40 input_type_{input.dtype()},
41 out_shape_{out.shape()},
42 out_strides_{out.strides()},
43 out_type_{out.dtype()},
44 device_index_{out.device().index()} {}
45
46 virtual void operator()(const Tensor input, const Tensor other,
47 Tensor out) const = 0;
48
49 virtual void operator()(const Tensor input, const int64_t dim,
50 const bool keepdim, Tensor max,
51 Tensor max_values) const = 0;
52
53 virtual void operator()(const Tensor input, 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 Tensor::Shape max_shape_;
75
76 Tensor::Strides max_strides_;
77
78 DataType max_type_;
79
80 Tensor::Shape max_values_shape_;
81
82 Tensor::Strides max_values_strides_;
83
85
86 int64_t dim_{};
87
88 bool keepdim_{};
89
91};
92
93} // namespace infini::ops
94
95#endif
Definition max.h:8
Tensor::Shape input_shape_
Definition max.h:56
DataType max_type_
Definition max.h:78
virtual void operator()(const Tensor input, Tensor out) const =0
Max(const Tensor input, Tensor out)
Definition max.h:37
Tensor::Shape max_values_shape_
Definition max.h:80
DataType input_type_
Definition max.h:60
DataType other_type_
Definition max.h:66
Tensor::Shape max_shape_
Definition max.h:74
Max(const Tensor input, const Tensor other, Tensor out)
Definition max.h:10
Max(const Tensor input, const int64_t dim, const bool keepdim, Tensor max, Tensor max_values)
Definition max.h:22
Tensor::Strides max_values_strides_
Definition max.h:82
Tensor::Shape out_shape_
Definition max.h:68
Tensor::Strides out_strides_
Definition max.h:70
DataType out_type_
Definition max.h:72
DataType max_values_type_
Definition max.h:84
Tensor::Shape other_shape_
Definition max.h:62
virtual void operator()(const Tensor input, const int64_t dim, const bool keepdim, Tensor max, Tensor max_values) const =0
Tensor::Strides input_strides_
Definition max.h:58
Tensor::Strides max_strides_
Definition max.h:76
int device_index_
Definition max.h:90
bool keepdim_
Definition max.h:88
int64_t dim_
Definition max.h:86
Tensor::Strides other_strides_
Definition max.h:64
virtual void operator()(const Tensor input, const Tensor other, Tensor out) const =0
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8