diff options
Diffstat (limited to 'candle-core/src')
-rw-r--r-- | candle-core/src/tensor.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs index 4aa2ff91..ffd190ca 100644 --- a/candle-core/src/tensor.rs +++ b/candle-core/src/tensor.rs @@ -1531,6 +1531,12 @@ impl Tensor { fn storage(&self) -> std::sync::RwLockReadGuard<'_, Storage> { self.storage.read().unwrap() } + + /// The storage used by this tensor, together with the layout to use to access it safely. + pub fn storage_and_layout(&self) -> (std::sync::RwLockReadGuard<'_, Storage>, &Layout) { + let storage = self.storage.read().unwrap(); + (storage, &self.layout) + } } macro_rules! bin_trait { |