Preliminary support for inplace ops. (#1921)

* Preliminary support for inplace ops.

* Add a test.
This commit is contained in:
Laurent Mazare
2024-03-23 14:16:19 +01:00
committed by GitHub
parent 790037390c
commit fdfe8fd129
5 changed files with 215 additions and 2 deletions

View File

@ -2254,6 +2254,10 @@ impl Tensor {
self.storage.read().unwrap()
}
pub(crate) fn storage_mut(&self) -> std::sync::RwLockWriteGuard<'_, Storage> {
self.storage.write().unwrap()
}
// If we extend the visibility of this function to be usable outside of this crate, we should
// make it unsafe.
pub(crate) fn storage_mut_and_layout(