Skip to content

Commit

Permalink
Fix constant pad
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Dec 19, 2024
1 parent d5fd94b commit 3fd8b0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion phiml/math/extrapolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3fd8b0a

Please sign in to comment.