summaryrefslogtreecommitdiff
path: root/candle-core/src/tensor.rs
diff options
context:
space:
mode:
authorNicolas Patry <patry.nicolas@protonmail.com>2023-07-10 17:34:04 +0200
committerNicolas Patry <patry.nicolas@protonmail.com>2023-07-10 17:34:04 +0200
commitef0375d8bcfcf2ec335a12a04d793d784dfca45d (patch)
tree8c0fb5e5dad2b532b9cbe0b524240ffd68590567 /candle-core/src/tensor.rs
parent221b1aff6594acd6d030c5131dba388590d1917f (diff)
downloadcandle-ef0375d8bcfcf2ec335a12a04d793d784dfca45d.tar.gz
candle-ef0375d8bcfcf2ec335a12a04d793d784dfca45d.tar.bz2
candle-ef0375d8bcfcf2ec335a12a04d793d784dfca45d.zip
`i(..)` indexing sugar (partial).
- Only range, and select (no tensor_select) - No negative indexing
Diffstat (limited to 'candle-core/src/tensor.rs')
-rw-r--r--candle-core/src/tensor.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs
index 9b0681e0..bcd380aa 100644
--- a/candle-core/src/tensor.rs
+++ b/candle-core/src/tensor.rs
@@ -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,
};