Skip to content

Commit 425062e

Browse files
chyomin06fracape
authored andcommitted
[fix] accepting batch size is greater than 1, needed during training
1 parent 0a8f7f1 commit 425062e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • compressai_vision/model_wrappers

compressai_vision/model_wrappers/yolox.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,13 @@ def input_to_features(self, x, device: str) -> Dict:
161161
"""Computes deep features at the intermediate layer(s) all the way from the input"""
162162

163163
self.model = self.model.to(device).eval()
164-
img = x[0]["image"].unsqueeze(0).to(device)
164+
165+
# temp. solution
166+
if not isinstance(x, torch.Tensor):
167+
img = x[0]["image"].unsqueeze(0).to(device)
168+
else:
169+
img = x
170+
165171
input_size = tuple(img.shape[2:])
166172

167173
if self.split_id == self.SPLIT_L13:

0 commit comments

Comments
 (0)