From e2257a7d3fa4b814ecf310e9cf8e000fdd0b85a5 Mon Sep 17 00:00:00 2001 From: Gabriel Gutierrez Date: Tue, 12 Nov 2024 20:56:52 -0300 Subject: [PATCH] Fix tensor type conversion in ResizedMetric to ensure proper handling of uint8 format --- minerva/analysis/metrics/transformed_metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minerva/analysis/metrics/transformed_metrics.py b/minerva/analysis/metrics/transformed_metrics.py index b394b1f..da0844a 100644 --- a/minerva/analysis/metrics/transformed_metrics.py +++ b/minerva/analysis/metrics/transformed_metrics.py @@ -177,5 +177,5 @@ def resize(self, x: torch.Tensor) -> torch.Tensor: elif self.target_w_size is None: scale = target_h_size / h target_w_size = int(w * scale) - x = x.to(torch.uint8) if x.type() == "torch.LongTensor" else x + x = x.to(torch.uint8) if x.type() != "torch.uint8" else x return torch.nn.functional.interpolate(x, size=(target_h_size, target_w_size))