Skip to content

Commit

Permalink
Shape refactor 8
Browse files Browse the repository at this point in the history
* Add back after_gather, after_pad, first_index
  • Loading branch information
holl- committed Dec 22, 2024
1 parent b9561ff commit df9ee02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions phiml/math/_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -2798,3 +2798,13 @@ def from_dict(dict_: dict):
if n and sizes[i] is None:
sizes[i] = len(n)
return Shape(tuple(sizes), names, tuple(dict_['types']), item_names)


def first_index(shape: Shape):
return next(iter(shape.meshgrid()))


for cls in [Dim, PureShape, MixedShape]:
cls.after_gather = after_gather
cls.after_pad = after_pad
cls.first_index = first_index

0 comments on commit df9ee02

Please sign in to comment.