Hello,
I’m here to ask a simple question of tensor. I would like to temporarily save a sub-array of tensor.
Let’s suppose I have a ([Batch, Channel, Width ,Height]) shape of tensor.
How can I extract only the entire subarray of Channel?
In this case, you would do [:, channel_number, :, :].
Actually, maybe I am not understanding your question fully. But if you have some number of channels with a certain height and width, I don’t think you can reshape to 1D with just (channel,). Could you please elaborate more perhaps?
Thanks for the clarification.
My purpose is to concatenate the entire tensors of channel with the half-size W and H array. (I will not use pooling operation) To be specific, if the shape of tensor is ([16(C), 112(W),112(H)]), then I firstly downscale only the H and W, and then want to combine with C. So it will be ([16,56,56]).
For this purpose, should I flatten them individually and then reshape it ?? since the array[:, channel_number, :, :] will give me a specific channel tensor instead of whole.