Concatenation tensors of different dimensions - Alexnet and Renet

Hello Everyone,

I have a question regarding concatenating two tensors. So basically, I need to extract first layer of ALexnet from my trained model, that output tensor of dimension ([8,64,34,34]) and first layer of Renet model that is already trained, which output tensor of dimension ([8,320,16,16])(Batch size, channel, H, W).
If I concatenate these two tensors, getting the below error.
RuntimeError: Sizes of tensors must match except in dimension 0. Got 64 and 320 in dimension 1 (The offending index is 1)
I am aware that the dimension should be the same but not sure how to fix the issue.
Could anyone help me with this issue?
Thanks in advance.

Some options:

  • down sample [8, 64, 34, 34] → [8, 320, 16, 16]
  • up sample [8, 320, 16, 16] → [8, 320, 32, 32]
  • repeat [8, 320, 16, 16] → [8, 320, 32, 32], then crop [8, 64, 34, 34] → [8, 64, 32, 32]

and so on…
It depends your task…