summaryrefslogtreecommitdiff
path: root/candle-core/src/tensor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'candle-core/src/tensor.rs')
-rw-r--r--candle-core/src/tensor.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs
index 978c3250..a4b9795b 100644
--- a/candle-core/src/tensor.rs
+++ b/candle-core/src/tensor.rs
@@ -497,10 +497,7 @@ impl Tensor {
let repeats = shape.into();
let repeats = repeats.dims();
let mut inp = if self.rank() < repeats.len() {
- let mut shape = self.dims().to_vec();
- while shape.len() < repeats.len() {
- shape.push(1)
- }
+ let shape = [vec![1; repeats.len() - self.rank()], self.dims().to_vec()].concat();
self.reshape(shape)?
} else {
self.clone()