From d4aacb7d98babd89495bcb6f38475851d16c2eca Mon Sep 17 00:00:00 2001 From: Jan Patrick Polster Date: Mon, 16 Dec 2024 16:25:08 +0100 Subject: [PATCH] fix via padding? --- src/anemoi/models/preprocessing/remapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/anemoi/models/preprocessing/remapper.py b/src/anemoi/models/preprocessing/remapper.py index 7cb15a66..1f3fa2a8 100644 --- a/src/anemoi/models/preprocessing/remapper.py +++ b/src/anemoi/models/preprocessing/remapper.py @@ -206,7 +206,7 @@ def transform(self, x: torch.Tensor, in_place: bool = True) -> torch.Tensor: ) # create new tensor with target number of columns - x_remapped = torch.zeros(x.shape[:-1] + (target_number_columns,), dtype=x.dtype, device=x.device) + x_remapped = torch.nn.functional.pad(x, (0, target_number_columns - x.shape[-1])) if in_place and not self.printed_preprocessor_warning: LOGGER.warning( "Remapper (preprocessor) called with in_place=True. This preprocessor cannot be applied in_place as new columns are added to the tensors.",