mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 19:18:50 +00:00
i(..)
indexing sugar (partial).
- Only range, and select (no tensor_select) - No negative indexing
This commit is contained in:
@ -444,6 +444,7 @@ impl Tensor {
|
||||
len,
|
||||
})?
|
||||
}
|
||||
println!("Narrow {start:?} - {} - {len} - {dims:?}", dims[dim]);
|
||||
if start == 0 && dims[dim] == len {
|
||||
Ok(self.clone())
|
||||
} else {
|
||||
@ -452,10 +453,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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user