From bcca6bdb4bde26b1f0198cfa9971bcf016c31bf8 Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Sun, 14 Jan 2024 22:33:41 +0100 Subject: [PATCH] Implement __eq__ for _SymmetricGradientExtrapolation --- phiml/math/extrapolation.py | 41 ++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/phiml/math/extrapolation.py b/phiml/math/extrapolation.py index 82b70d98..28695e8e 100644 --- a/phiml/math/extrapolation.py +++ b/phiml/math/extrapolation.py @@ -899,7 +899,7 @@ def sparse_pad_values(self, value: Tensor, connectivity: Tensor, dim: str, **kwa raise NotImplementedError -class _SymmetricGradientExtrapolation(Extrapolation): # ToDo this class is missing a lot of methods +class _SymmetricGradientExtrapolation(Extrapolation): def __init__(self): super().__init__(pad_rank=3) @@ -930,6 +930,45 @@ def pad_values(self, value: Tensor, width: int, dim: str, upper_edge: bool, alre def sparse_pad_values(self, value: Tensor, connectivity: Tensor, dim: str, **kwargs) -> Tensor: raise NotImplementedError + def determines_boundary_values(self, boundary_key: Union[Tuple[str, bool], str]) -> bool: + raise NotImplementedError + + def __eq__(self, other): + return isinstance(other, _SymmetricGradientExtrapolation) + + def __hash__(self): + return 209385671 + + def __abs__(self): + raise NotImplementedError + + def __neg__(self): + raise NotImplementedError + + def __add__(self, other): + raise NotImplementedError + + def __radd__(self, other): + raise NotImplementedError + + def __sub__(self, other): + raise NotImplementedError + + def __rsub__(self, other): + raise NotImplementedError + + def __mul__(self, other): + raise NotImplementedError + + def __rmul__(self, other): + raise NotImplementedError + + def __truediv__(self, other): + raise NotImplementedError + + def __rtruediv__(self, other): + raise NotImplementedError + class _NoExtrapolation(Extrapolation): # singleton