InfiniOps
Operator Library for Accelerators
Loading...
Searching...
No Matches
linalg_svd.h
Go to the documentation of this file.
1#ifndef INFINI_OPS_BASE_LINALG_SVD_H_
2#define INFINI_OPS_BASE_LINALG_SVD_H_
3
4#include <optional>
5#include <string>
6
7#include "operator.h"
8
9namespace infini::ops::linalg {
10
11class Svd : public Operator<Svd> {
12 public:
13 Svd(const Tensor A, const bool full_matrices,
14 const std::optional<std::string> driver, Tensor U, Tensor S, Tensor Vh)
15 : A_shape_{A.shape()},
16 A_strides_{A.strides()},
17 A_type_{A.dtype()},
18 U_shape_{U.shape()},
19 U_strides_{U.strides()},
20 U_type_{U.dtype()},
21 S_shape_{S.shape()},
22 S_strides_{S.strides()},
23 S_type_{S.dtype()},
24 Vh_shape_{Vh.shape()},
25 Vh_strides_{Vh.strides()},
26 Vh_type_{Vh.dtype()},
27 full_matrices_{full_matrices},
28 driver_{driver},
29 device_index_{U.device().index()} {}
30
31 virtual void operator()(const Tensor A, const bool full_matrices,
32 const std::optional<std::string> driver, Tensor U,
33 Tensor S, Tensor Vh) const = 0;
34
35 protected:
36 Tensor::Shape A_shape_;
37
38 Tensor::Strides A_strides_;
39
40 DataType A_type_;
41
42 Tensor::Shape U_shape_;
43
44 Tensor::Strides U_strides_;
45
46 DataType U_type_;
47
48 Tensor::Shape S_shape_;
49
50 Tensor::Strides S_strides_;
51
52 DataType S_type_;
53
54 Tensor::Shape Vh_shape_;
55
56 Tensor::Strides Vh_strides_;
57
58 DataType Vh_type_;
59
61
62 std::optional<std::string> driver_{};
63
65};
66
67} // namespace infini::ops::linalg
68
69#endif
Definition generated/include/operator.h:282
Definition linalg_svd.h:11
std::optional< std::string > driver_
Definition linalg_svd.h:62
Tensor::Strides A_strides_
Definition linalg_svd.h:38
virtual void operator()(const Tensor A, const bool full_matrices, const std::optional< std::string > driver, Tensor U, Tensor S, Tensor Vh) const =0
Tensor::Strides Vh_strides_
Definition linalg_svd.h:56
Tensor::Strides S_strides_
Definition linalg_svd.h:50
Tensor::Shape U_shape_
Definition linalg_svd.h:42
DataType Vh_type_
Definition linalg_svd.h:58
Tensor::Shape S_shape_
Definition linalg_svd.h:48
Tensor::Strides U_strides_
Definition linalg_svd.h:44
Tensor::Shape A_shape_
Definition linalg_svd.h:36
int device_index_
Definition linalg_svd.h:64
DataType S_type_
Definition linalg_svd.h:52
Tensor::Shape Vh_shape_
Definition linalg_svd.h:54
DataType U_type_
Definition linalg_svd.h:46
bool full_matrices_
Definition linalg_svd.h:60
Svd(const Tensor A, const bool full_matrices, const std::optional< std::string > driver, Tensor U, Tensor S, Tensor Vh)
Definition linalg_svd.h:13
DataType A_type_
Definition linalg_svd.h:40
Definition linalg_cholesky.h:6
infini::rt::TensorView Tensor
Definition tensor.h:8