File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,25 @@ impl TensorDesc {
3232 }
3333 }
3434
35+ /// Layout of the tensor.
36+ pub fn layout ( & self ) -> Layout {
37+ self . instance . layout
38+ }
39+
40+ /// Dimensions of the tensor.
41+ ///
42+ /// Length of the slice is equal to the tensor rank.
43+ pub fn dims ( & self ) -> & [ usize ] {
44+ & self . instance . dims . dims [ ..self . instance . dims . ranks ]
45+ }
46+
47+ /// Precision of the tensor.
48+ pub fn precision ( & self ) -> Precision {
49+ self . instance . precision
50+ }
51+
3552 /// Get the number of elements described by this [`TensorDesc`].
3653 pub fn len ( & self ) -> usize {
37- self . instance . dims . dims [ ..self . instance . dims . ranks as usize ]
38- . iter ( )
39- . fold ( 1 , |a, & b| a * b as usize )
54+ self . dims ( ) . iter ( ) . fold ( 1 , |a, & b| a * b as usize )
4055 }
4156}
You can’t perform that action at this time.
0 commit comments