File tree 2 files changed +37
-36
lines changed
2 files changed +37
-36
lines changed Original file line number Diff line number Diff line change 1
- #pragma once
2
-
3
- #include < c10/core/Backend.h>
4
- #include < c10/util/Exception.h>
5
-
6
- #include < iostream>
7
-
8
- namespace at {
9
- enum class Layout : int8_t { Strided, Sparse };
10
-
11
- constexpr auto kStrided = Layout::Strided;
12
- constexpr auto kSparse = Layout::Sparse;
13
-
14
- inline Layout layout_from_backend (Backend backend) {
15
- switch (backend) {
16
- case Backend::SparseCPU:
17
- case Backend::SparseCUDA:
18
- case Backend::SparseHIP:
19
- return Layout::Sparse;
20
- default :
21
- return Layout::Strided;
22
- }
23
- }
24
-
25
- inline std::ostream& operator <<(std::ostream& stream, at::Layout layout) {
26
- switch (layout) {
27
- case at::kStrided :
28
- return stream << " Strided" ;
29
- case at::kSparse :
30
- return stream << " Sparse" ;
31
- default :
32
- AT_ERROR (" Unknown layout" );
33
- }
34
- }
35
-
36
- } // namespace at
1
+ #include <c10/core/Layout.h>
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+
3
+ #include < c10/core/Backend.h>
4
+ #include < c10/util/Exception.h>
5
+
6
+ #include < iostream>
7
+
8
+ namespace c10 {
9
+ enum class Layout : int8_t { Strided, Sparse };
10
+
11
+ constexpr auto kStrided = Layout::Strided;
12
+ constexpr auto kSparse = Layout::Sparse;
13
+
14
+ inline Layout layout_from_backend (Backend backend) {
15
+ switch (backend) {
16
+ case Backend::SparseCPU:
17
+ case Backend::SparseCUDA:
18
+ case Backend::SparseHIP:
19
+ return Layout::Sparse;
20
+ default :
21
+ return Layout::Strided;
22
+ }
23
+ }
24
+
25
+ inline std::ostream& operator <<(std::ostream& stream, at::Layout layout) {
26
+ switch (layout) {
27
+ case at::kStrided :
28
+ return stream << " Strided" ;
29
+ case at::kSparse :
30
+ return stream << " Sparse" ;
31
+ default :
32
+ AT_ERROR (" Unknown layout" );
33
+ }
34
+ }
35
+
36
+ } // namespace c10
You can’t perform that action at this time.
0 commit comments