Skip to content

Commit

Permalink
Update __torch_function__ idiom (#599)
Browse files Browse the repository at this point in the history
Co-authored-by: Fritz Obermeyer <fobermeyer@generatebiomedicines.com>
  • Loading branch information
fritzo and Fritz Obermeyer committed Oct 28, 2022
1 parent 1d07af1 commit 0a8e4b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion funsor/torch/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def __init__(self, data, provenance=frozenset()):
def __repr__(self):
return "Provenance:\n{}\nTensor:\n{}".format(self._provenance, self._t)

def __torch_function__(self, func, types, args=(), kwargs=None):
@classmethod
def __torch_function__(cls, func, types, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
# collect provenance information from args
Expand Down

0 comments on commit 0a8e4b2

Please sign in to comment.