Skip to content

Commit

Permalink
make sure that the behavior is consistent for attrgetter
Browse files Browse the repository at this point in the history
  • Loading branch information
fehiepsi committed Nov 13, 2024
1 parent 33cd1fd commit 4407e60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numpyro/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ def nested_attrgetter(*collect_fields):
"""

def getter(obj):
return tuple(_get_nested_attr(obj, field) for field in collect_fields)
results = tuple(_get_nested_attr(obj, field) for field in collect_fields)
return results if len(collect_fields) > 1 else results[0]

return getter

Expand Down

0 comments on commit 4407e60

Please sign in to comment.