Skip to content

Commit

Permalink
Make eval_shape and invertible overridable
Browse files Browse the repository at this point in the history
  • Loading branch information
shoyer committed Feb 8, 2021
1 parent 06987b4 commit c5f9f86
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jax/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,8 @@ def __eq__(self, other):
def __hash__(self):
return hash((self.shape, self.dtype))


@overrideable('eval_shape')
def eval_shape(fun: Callable, *args, **kwargs):
"""Compute the shape/dtype of ``fun`` without any FLOPs.
Expand Down Expand Up @@ -2623,6 +2625,7 @@ def vjpfun(ct):
return ans, vjpfun
defvjp_all(fun, custom_vjp)

@overrideable('invertible')
def invertible(fun: Callable) -> Callable:
"""Asserts that the decorated function is invertible.
Expand Down

0 comments on commit c5f9f86

Please sign in to comment.