logankilpatrick
logankilpatrick

Reputation: 14521

How to do Adaptive average pooling in Flux.jl

I have seen that adaptive average pooling is available both in Tensor Flow and PyTorch.

I am wondering how this can be achieved in Flux.jl?

Upvotes: 2

Views: 184

Answers (1)

logankilpatrick
logankilpatrick

Reputation: 14521

Flux actually does have a built in function which creates an Adaptive pooling layer:

julia> xs = rand(Float32, 100, 100, 3, 50);  # batch of 50 RGB images

julia> AdaptiveMeanPool((25, 25))(xs) |> size
(25, 25, 3, 50)

As you can see in the above example, it expects two additional array elements as input in addition to N feature dimensions. In this case, there are two feature dimensions (100, 100). Three represents the number of channels of the images (Red, Green, and Blue) and the 50 represents the number of images.

Upvotes: 1

Related Questions