tch_plus/wrappers/
layout.rs

1/// A tensor layout.
2
3#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
4pub enum Layout {
5    Strided,
6    Sparse,
7    SparseCsr,
8    Mkldnn,
9    SparseCsc,
10    SparseBsr,
11    SparseBsc,
12    NumOptions,
13}
14
15impl Layout {
16    // This should be kept in sync with include/c10/core/Layout.h
17    pub fn to_i8(&self) -> i8 {
18        match self {
19            Self::Strided => 0,
20            Self::Sparse => 1,
21            Self::SparseCsr => 2,
22            Self::Mkldnn => 3,
23            Self::SparseCsc => 4,
24            Self::SparseBsr => 5,
25            Self::SparseBsc => 6,
26            Self::NumOptions => 7,
27        }
28    }
29}