Skip to content

AdaptiveAveragePooling: Number of ways to split should evenly divide the split dimension #2321

Open
@shkarupa-alex

Description

@shkarupa-alex

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Google Colab
  • TensorFlow version and how it was installed (source or binary): Google Colab
  • TensorFlow-Addons version and how it was installed (source or binary): 0.12.0
  • Python version: 3
  • Is GPU used? (yes/no): no

Describe the bug
AdaptiveAveragePooling2D fails when input dimension not dividable by pool size
In contrast, PyTorch version of AdaptivePooling2D works well in the same case.

Code to reproduce the issue

import tensorflow as tf
import tensorflow_addons as tfa

layer = tfa.layers.AdaptiveAveragePooling2D(3)
batch = tf.random.uniform((2, 16, 16, 5))
layer(batch)

Other info / logs

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-6-e9a53d37389e> in <module>()
      1 layer = tfa.layers.AdaptiveAveragePooling2D(3)
      2 batch = tf.random.uniform((2, 16, 16, 5))
----> 3 layer(batch)

6 frames
/usr/local/lib/python3.6/dist-packages/six.py in raise_from(value, from_value)

InvalidArgumentError: Number of ways to split should evenly divide the split dimension, but got split_dim 1 (size = 16) and num_split 3 [Op:Split] name: split

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions