From 3fd8b0ac3f6fb92de9794bb876afbae750a919ce Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Thu, 19 Dec 2024 13:15:10 +0100 Subject: [PATCH] Fix constant pad --- phiml/math/extrapolation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phiml/math/extrapolation.py b/phiml/math/extrapolation.py index a70afb2..720e499 100644 --- a/phiml/math/extrapolation.py +++ b/phiml/math/extrapolation.py @@ -297,7 +297,7 @@ def pad(self, value: Tensor, widths: dict, already_padded: Optional[dict] = None for dim in pad_value.shape.non_batch.names: assert dim in value.shape, f"Cannot pad tensor {value.shape} with extrapolation {pad_value.shape} because non-batch dimension '{dim}' is missing." if pad_value.rank == 0: - equal_values = math.all_available(self.value, value) and value._native_shape in self.value.shape and (self.value == value).all + equal_values = math.always_close(self.value, value, 0, 0, equal_nan=True) if not equal_values: required_dims = value._shape.only(tuple(widths.keys())) value = value._cached(required_dims)