The Self Attention forward part using 5D tesnor can be used in 4D tensor #2587
Unanswered
deeperlearner
asked this question in
Q&A
Replies: 1 comment
-
@deeperlearner I think I actually had it like that years ago on first impl but opted for unbind, next in line would be chunk due to clarity. At this point I don't feel it makes sense to change this, there are too many users and this could subtly impact things. So for your case, best solution would be to implement a module with the necessary change locally and patch it after creating the model, pretty easy to do and would let you use timm weights and model structure for training and then export to Ambarella devices for inference... Something like this (might need some tweaks but idea is sound)
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
pytorch-image-models/timm/layers/attention.py
Lines 75 to 76 in 019550e
I'm using Ambarella transfering toolchain, which only support 4D tensors. This part, which uses a 5D tensor, causes an error every time I call the self-attention function.
I'm just proposing a method here that uses only 4D tensors for replacement.
I know the 5D tensor version is more readable, but the 4D tensor version solved my problem.
Beta Was this translation helpful? Give feedback.
All reactions