'NestedTensor' object has no attribute 'size' #255
Replies: 3 comments 4 replies
-
I have a similar problem. This function requires a single tensor, but somehow I pass a batch of tensors to this. In my case list of tensors, so I have
|
Beta Was this translation helpful? Give feedback.
-
@Aliweka2020 So, I fixed this problem on my side. I use
to this:
because as I mentioned, the efficientdet requires tensor (Batch x Channels x Height x Width) not list or NestedTensor. There are more possible fixes to this problem.
|
Beta Was this translation helpful? Give feedback.
-
I'm going to move this to discussions since it isn't a bug. The workound @arekmula provided if you're using a training setup that uses lists or tuples is correct, the 'bench' wrappers for training here expect tensors. Another approach would be to write an alternate Train/Predict bench wrapper (https://github.com/rwightman/efficientdet-pytorch/blob/master/effdet/bench.py#L79) that accept sequences. ie DetBenchTrainSeq / DetBenchPredictSeq ... and modify the factory create fn to accept 'train_seq' and 'predict_seq' as the bench type. I'd accept a PR for that. For nested tensor, I haven't spent much time with it, but since it's out of PyTorch tree it's not a high priority for me to support but likely can be supported with a similar approach as above (specific bench wrappers). |
Beta Was this translation helpful? Give feedback.
-
I am trying to use efficientnet bacbone with DETR but get this error
File "C:\Users\Ali\AppData\Local\Continuum\anaconda3\lib\site-packages\timm\models\layers\padding.py", line 32, in pad_same
ih, iw = x.size()[-2:]
AttributeError: 'NestedTensor' object has no attribute 'size'
I searched for NestedTensor to unpack to get the dimension but useless.
Could anyone help?!
Beta Was this translation helpful? Give feedback.
All reactions