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