You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if scales.numel() == 1:
scales = scales.item()
else:
scales = scales.cpu().tolist()
if len(scales) == 2:
# 大家相安无事,和平共处
pass
elif len(scales) == 4:
if scales[:2] != [1, 1]:
raise NotImplementedError(
'Can not resize your image with current op, '
'cause 4-dimension resize is not implemented with pytorch.')
scales = scales[2:]
else:
raise NotImplementedError(
'Can not resize your image with current op, '
f'cause {len(scales)}-dimension resize is not implemented with pytorch.')
如下面的 code snippet 所示,当 resize 操作以 scales 而非 sizes 来规定输出大小时。若传入的 scale 只有一个元素则没什么问题,当输入的
scales.numel() > 1
时,1089 行只取scale[-2]
送进torch.nn.functional.interpolate
,即另外一个 dimension 的输入 scale_factor 压根没用上,结果导致后续跟一些 concat 类操作时,由于 dimension 不对,很容易扑街。看 1088 行其实已经先校验了
scales.numel() % 2 == 0
,猜测实际上这是一个scales[-2:]
->scales[-2]
的 typo?https://github.com/openppl-public/ppq/blob/0fdea7d4982bc57feb6bb8548c7f012707fbd607/ppq/executor/op/torch/default.py#L1083-L1089
The text was updated successfully, but these errors were encountered: