Skip to content

Commit

Permalink
Clarify shape inference logic - commits to be refactored into one
Browse files Browse the repository at this point in the history
  • Loading branch information
larryshamalama committed Apr 28, 2022
1 parent 96f87f2 commit 1848002
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions aesara/tensor/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,20 @@ def make_node(self, x, *inputs):
continue
else:
if shp is not None:
if p.start == 0 or p.start is None:
start = 0
else:
start = p.start

if p.stop == 0 or p.stop is None:
stop = shp
else:
stop = p.stop

if p.step == 1 or p.step is None:
length = max(p.stop - p.start, 0)
length = max(stop - start, 0)
else:
length = (p.stop - p.start - 1) // p.step + 1
length = (stop - start - 1) // p.step + 1
static_shape.append(length)
else:
static_shape.append(None)
Expand Down

0 comments on commit 1848002

Please sign in to comment.