InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
addmv.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_ADDMV_H_
2#define INFINI_OPS_BASE_ADDMV_H_
3
4#include "operator.h"
5
6namespace infini::ops {
7
8class Addmv : public Operator<Addmv> {
9 public:
10 Addmv(const Tensor input, const Tensor mat, const Tensor vec,
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 mat_shape_{mat.shape()},
16 mat_strides_{mat.strides()},
17 mat_type_{mat.dtype()},
18 vec_shape_{vec.shape()},
19 vec_strides_{vec.strides()},
20 vec_type_{vec.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 mat,
29 const Tensor vec, 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 mat_shape_;
40
41 Tensor::Strides mat_strides_;
42
43 DataType mat_type_;
44
45 Tensor::Shape vec_shape_;
46
47 Tensor::Strides vec_strides_;
48
49 DataType vec_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 addmv.h:8
Tensor::Shape input_shape_
Definition addmv.h:33
Tensor::Strides out_strides_
Definition addmv.h:53
Addmv(const Tensor input, const Tensor mat, const Tensor vec, const double beta, const double alpha, Tensor out)
Definition addmv.h:10
DataType input_type_
Definition addmv.h:37
virtual void operator()(const Tensor input, const Tensor mat, const Tensor vec, const double beta, const double alpha, Tensor out) const =0
Tensor::Shape out_shape_
Definition addmv.h:51
int device_index_
Definition addmv.h:61
Tensor::Strides vec_strides_
Definition addmv.h:47
Tensor::Shape vec_shape_
Definition addmv.h:45
DataType vec_type_
Definition addmv.h:49
Tensor::Shape mat_shape_
Definition addmv.h:39
double alpha_
Definition addmv.h:59
Tensor::Strides input_strides_
Definition addmv.h:35
DataType mat_type_
Definition addmv.h:43
double beta_
Definition addmv.h:57
Tensor::Strides mat_strides_
Definition addmv.h:41
DataType out_type_
Definition addmv.h:55
Definition generated/include/operator.h:282
Definition generated/include/operator.h:28
infini::rt::TensorView Tensor
Definition tensor.h:8