Skip to content

Commit abbe56a

Browse files
authored
Update src/anomalib/deploy/inferencers/torch_inferencer.py
1 parent 5968f76 commit abbe56a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/anomalib/deploy/inferencers/torch_inferencer.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ def pre_process(self, image: np.ndarray) -> torch.Tensor:
206206
Returns:
207207
Tensor: pre-processed image.
208208
"""
209-
if len (image.shape) == 3:
210-
transposed_image = image.transpose(2,0,1).copy()
211-
else:
212-
transposed_image = image.copy()
209+
transposed_image = image.transpose(2, 0, 1).copy() if len(image.shape) == 3 else image.copy()
213210

214211
if len(transposed_image) == 3:
215212
return torch.from_numpy(transposed_image).float().to(self.device).unsqueeze(0)

0 commit comments

Comments
 (0)