diff --git a/phi/geom/_mesh.py b/phi/geom/_mesh.py index 01a1d4891..972ea6ec8 100644 --- a/phi/geom/_mesh.py +++ b/phi/geom/_mesh.py @@ -152,8 +152,6 @@ def interior_faces(self) -> Dict[str, slice]: return {self.face_shape.dual.name: slice(0, instance(self).volume)} def pad_boundary(self, value: Tensor, widths: Dict[str, Dict[str, slice]] = None, mode: Extrapolation or Tensor or Number = 0, **kwargs) -> Tensor: - if isinstance(widths, dict) and len(widths) == 0: - return value mode = as_extrapolation(mode) if self.face_shape.dual.name not in value.shape: value = rename_dims(value, instance, self.face_shape.dual) @@ -161,6 +159,8 @@ def pad_boundary(self, value: Tensor, widths: Dict[str, Dict[str, slice]] = None raise NotImplementedError if widths is None: widths = self.boundary_faces + if isinstance(widths, dict) and len(widths) == 0: + return value if isinstance(widths, (tuple, list)): if len(widths) == 0 or isinstance(widths[0], dict): # add sliced-off slices pass