0
$\begingroup$

I have an input tensor of the shape (32, 256, 256, 256). In this tensor shape, 32 is the batch size. second 256 is the number of channels in the given image of size 256 X 256.

I want to do pooling in order to convert the tensor into the shape(32, 32, 256, 256). In PyTorch, if I try to apply the pooling then the last two dimensions of the shape, related to the image, are changing, but not the dimension related to the channel.

Is it possible to apply pooling on the input tensor to obtain the output tensor? If not possible, what are the recommended options for me to convert the input tensor into the output tensor?

$\endgroup$
0
$\begingroup$

I don't think what you want to do can be done by a pooling layer, but it might be possible by using a "convolutional layer" with 32 filters. You need to use proper padding and stride, such as discussed in this post to preserve size.

And if you want to mimic pooling, you may need to use a custom layer with no activation function (or linear activation). The parameters in the layer needs to be set to non-trainable, and initialized by hand.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.