Skip to content

Commit be6ed82

Browse files
Use shape_padright instead of .reshape tricks
1 parent 8f213a3 commit be6ed82

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytensor/tensor/extra_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ def _linspace_core(
16231623
) -> TensorVariable | tuple[TensorVariable, TensorVariable]:
16241624
div = (num - 1) if endpoint else num
16251625
delta = stop - start
1626-
samples = ptb.arange(0, num).reshape((-1,) + (1,) * delta.ndim)
1626+
samples = ptb.shape_padright(ptb.arange(0, num), delta.ndim)
16271627

16281628
step = delta / div
16291629
samples = switch(gt(div, 0), samples * delta / div + start, samples * delta + start)

0 commit comments

Comments
 (0)