Merge pull request #127 from LaurentMazare/tensor_indexing

`i(..)` indexing sugar (partial).
This commit is contained in:
Nicolas Patry
2023-07-10 19:56:34 +02:00
committed by GitHub
3 changed files with 246 additions and 1 deletions

View File

@ -504,10 +504,11 @@ impl Tensor {
} else {
None
};
let layout = self.layout().narrow(dim, start, len)?;
let tensor_ = Tensor_ {
id: TensorId::new(),
storage: self.storage.clone(),
layout: self.layout().narrow(dim, start, len)?,
layout,
op,
is_variable: false,
};