user10282036
user10282036

Reputation: 331

Pytorch adaptive_avg_pool2d algorithm

Anyone knows the algorithm for pytorch adaptive_avg_pool2d, for example,

adaptive_avg_pool2d(image,[14,14])

so question: I want to do the same in keras neural network, for any give inputs, want to get 14*14 output. Any suggestions?

Upvotes: 0

Views: 326

Answers (1)

Josh Mitton
Josh Mitton

Reputation: 151

I don't think this exists in Keras. You could get the dimension of your input and divide by 14 to get the desired pool_size.

For example if your inputs are 28x28 you can use:

keras.layers.AveragePooling2D(pool_size=(2, 2), strides=None, padding='valid', data_format=None)

Upvotes: 1

Related Questions