fix tensor to np

This commit is contained in:
Vladimir Mandic
2023-12-10 18:06:07 -05:00
parent 4823595dc9
commit d71287e068
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -757,7 +757,7 @@ def validate_sample(tensor):
sample = 255.0 * np.moveaxis(tensor.cpu().numpy(), 0, 2)
else:
sample = 255.0 * tensor
if isinstance(tensor, torch.Tensor):
if isinstance(tensor, torch.Tensor) and hasattr(tensor, 'detach'):
sample = sample.detach().cpu().numpy()
with warnings.catch_warnings(record=True) as w:
cast = sample.astype(np.uint8)