InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
addr.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_ADDR_H_
2#define INFINI_OPS_BASE_ADDR_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Addr : public Operator<Addr> {
9 public:
10 Addr(const Tensor input, const Tensor vec1, const Tensor vec2,
11 const double beta, const double alpha, Tensor out)
12 : input_shape_{input.shape()},
13 input_strides_{input.strides()},
14 input_type_{input.dtype()},
15 vec1_shape_{vec1.shape()},
16 vec1_strides_{vec1.strides()},
17 vec1_type_{vec1.dtype()},
18 vec2_shape_{vec2.shape()},
19 vec2_strides_{vec2.strides()},
20 vec2_type_{vec2.dtype()},
21 out_shape_{out.shape()},
22 out_strides_{out.strides()},
23 out_type_{out.dtype()},
24 beta_{beta},
25 alpha_{alpha},
26 device_index_{out.device().index()} {}
27
28 virtual void operator()(const Tensor input, const Tensor vec1,
29 const Tensor vec2, const double beta,
30 const double alpha, Tensor out) const = 0;
31
32 protected:
33 Tensor::Shape input_shape_;
34
35 Tensor::Strides input_strides_;
36
37 DataType input_type_;
38
39 Tensor::Shape vec1_shape_;
40
41 Tensor::Strides vec1_strides_;
42
43 DataType vec1_type_;
44
45 Tensor::Shape vec2_shape_;
46
47 Tensor::Strides vec2_strides_;
48
49 DataType vec2_type_;
50
51 Tensor::Shape out_shape_;
52
53 Tensor::Strides out_strides_;
54
55 DataType out_type_;
56
57 double beta_{};
58
59 double alpha_{};
60
62};
63
64} // namespace infini::ops
65
66#endif
Definition addr.h:8
Tensor::Shape input_shape_
Definition addr.h:33
DataType input_type_
Definition addr.h:37
DataType out_type_
Definition addr.h:55
virtual void operator()(const Tensor input, const Tensor vec1, const Tensor vec2, const double beta, const double alpha, Tensor out) const =0
double alpha_
Definition addr.h:59
Tensor::Strides vec1_strides_
Definition addr.h:41
int device_index_
Definition addr.h:61
DataType vec1_type_
Definition addr.h:43
Tensor::Shape vec2_shape_
Definition addr.h:45
Tensor::Shape vec1_shape_
Definition addr.h:39
Tensor::Strides vec2_strides_
Definition addr.h:47
DataType vec2_type_
Definition addr.h:49
Addr(const Tensor input, const Tensor vec1, const Tensor vec2, const double beta, const double alpha, Tensor out)
Definition addr.h:10
double beta_
Definition addr.h:57
Tensor::Strides out_strides_
Definition addr.h:53
Tensor::Strides input_strides_
Definition addr.h:35
Tensor::Shape out_shape_
Definition addr.h:51
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8