Repository: tensorflow/addons

Issue:
poincare_test.py is not run by bazel
**Describe the bug**

This time it's just that it's not declared in the BUILD.

**Code to reproduce the issue**

Provide a reproducible test case that is the bare minimum necessary to generate the problem.

```
bazel test //tensorflow_addons/layers:poincare_test.py
```

```
INFO: Writing tracer profile to '/home/gdemarmi/.cache/bazel/_bazel_gdemarmi/c0c8233ef0c2491af30539fc61a9ec68/command.profile.gz'
ERROR: Skipping '//tensorflow_addons/layers:poincare_test.py': no such target '//tensorflow_addons/layers:poincare_test.py': target 'poincare_test.py' not declared in package 'tensorflow_addons/layers'; however, a source file of this name exists.  (Perhaps add 'exports_files(["poincare_test.py"])' to tensorflow_addons/layers/BUILD?) defined by /mnt/c/Users/gdemarmi/Desktop/projects/addons/tensorflow_addons/layers/BUILD
ERROR: no such target '//tensorflow_addons/layers:poincare_test.py': target 'poincare_test.py' not declared in package 'tensorflow_addons/layers'; however, a source file of this name exists.  (Perhaps add 'exports_files(["poincare_test.py"])' to tensorflow_addons/layers/BUILD?) defined by /mnt/c/Users/gdemarmi/Desktop/projects/addons/tensorflow_addons/layers/BUILD
INFO: Elapsed time: 0.372s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
```

**Other info / logs**

When actually running the tests in the file, we get this error:

```
(proof_of_concept_pytest) /mnt/c/Users/gdemarmi/Desktop/projects/addons $ pytest -v tensorflow_addons/layers/poincare_test.py
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/pep8.py:110: FutureWarning: Possible nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
================================================================================== test session starts ==================================================================================
platform linux -- Python 3.7.5, pytest-5.0.1, py-1.8.0, pluggy-0.13.0 -- /home/gdemarmi/softwares/python/anaconda/bin/python
cachedir: .pytest_cache
rootdir: /mnt/c/Users/gdemarmi/Desktop/projects/addons
plugins: arraydiff-0.3, cov-2.7.1, doctestplus-0.2.0, flake8-1.0.4, forked-1.0.2, openfiles-0.4.0, pep8-1.0.6, remotedata-0.3.2, xdist-1.27.0, typeguard-2.7.1
collected 3 items

tensorflow_addons/layers/poincare_test.py::PoincareNormalizeTest::testPoincareNormalize PASSED                                                                                    [ 33%]
tensorflow_addons/layers/poincare_test.py::PoincareNormalizeTest::testPoincareNormalizeDimArray FAILED                                                                            [ 66%]
tensorflow_addons/layers/poincare_test.py::PoincareNormalizeTest::test_session SKIPPED                                                                                            [100%]

======================================================================================= FAILURES ========================================================================================
__________________________________________________________________ PoincareNormalizeTest.testPoincareNormalizeDimArray __________________________________________________________________

self = <tensorflow_addons.layers.poincare_test.PoincareNormalizeTest testMethod=testPoincareNormalizeDimArray>, args = (), kwargs = {}

    def decorated(self, *args, **kwargs):
      try:
        with context.graph_mode():
          with self.test_session(use_gpu=use_gpu, config=config):
>           f(self, *args, **kwargs)

/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/tensorflow_core/python/framework/test_util.py:1111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tensorflow_addons/layers/poincare_test.py:71: in testPoincareNormalizeDimArray
    expected_output=outputs_expected,
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/tensorflow_core/python/framework/test_util.py:1666: in decorated
    result = f(self, *args, **kwargs)
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/tensorflow_core/python/keras/testing_utils.py:126: in layer_test
    layer = layer_cls(**kwargs)
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/typeguard/__init__.py:809: in wrapper
    check_argument_types(memo)
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/typeguard/__init__.py:670: in check_argument_types
    raise exc from None
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/typeguard/__init__.py:668: in check_argument_types
    check_type(description, value, expected_type, memo)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

argname = 'argument "axis"', value = [1, 2], expected_type = <class 'int'>, memo = <typeguard._CallMemo object at 0x7f59a4229440>

    def check_type(argname: str, value, expected_type, memo: Optional[_CallMemo] = None) -> None:
        """
        Ensure that ``value`` matches ``expected_type``.

        The types from the :mod:`typing` module do not support :func:`isinstance` or :func:`issubclass`
        so a number of type specific checks are required. This function knows which checker to call
        for which type.

        :param argname: name of the argument to check; used for error messages
        :param value: value to be checked against ``expected_type``
        :param expected_type: a class or generic type instance

        """
        if expected_type is Any:
            return

        if expected_type is None:
            # Only happens on < 3.6
            expected_type = type(None)

        origin_type = getattr(expected_type, '__origin__', None)
        if origin_type is not None:
            checker_func = origin_type_checkers.get(origin_type)
            if checker_func:
                checker_func(argname, value, expected_type, memo)
            else:
                check_type(argname, value, origin_type, memo)
        elif isclass(expected_type):
            if issubclass(expected_type, Tuple):
                check_tuple(argname, value, expected_type, memo)
            elif issubclass(expected_type, Callable) and hasattr(expected_type, '__args__'):
                # Needed on Python 3.5.0 to 3.5.2
                check_callable(argname, value, expected_type, memo)
            elif issubclass(expected_type, (float, complex)):
                check_number(argname, value, expected_type)
            elif _subclass_check_unions and issubclass(expected_type, Union):
                check_union(argname, value, expected_type, memo)
            elif isinstance(expected_type, TypeVar):
                check_typevar(argname, value, expected_type, memo)
            elif issubclass(expected_type, IO):
                check_io(argname, value, expected_type)
            elif issubclass(expected_type, dict) and hasattr(expected_type, '__annotations__'):
                check_typed_dict(argname, value, expected_type, memo)
            elif getattr(expected_type, '_is_protocol', False):
                check_protocol(argname, value, expected_type)
            else:
                expected_type = (getattr(expected_type, '__extra__', None) or origin_type or
                                 expected_type)

                if expected_type is bytes:
                    # As per https://github.com/python/typing/issues/552
                    expected_type = (bytearray, bytes)

                if not isinstance(value, expected_type):
                    raise TypeError(
                        'type of {} must be {}; got {} instead'.
>                       format(argname, qualified_name(expected_type), qualified_name(value)))
E                   TypeError: type of argument "axis" must be int; got list instead

/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/typeguard/__init__.py:598: TypeError
=================================================================================== warnings summary ====================================================================================
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/google/protobuf/descriptor.py:47
  /home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/google/protobuf/descriptor.py:47: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from google.protobuf.pyext import _message

/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1
/home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1
  /home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/botocore/vendored/requests/packages/urllib3/_collections.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from collections import Mapping, MutableMapping

tensorflow_addons/layers/poincare_test.py::PoincareNormalizeTest::testPoincareNormalize
  /home/gdemarmi/softwares/python/anaconda/lib/python3.7/site-packages/tensorflow_core/python/framework/indexed_slices.py:348: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    if not isinstance(values, collections.Sequence):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============================================================== 1 failed, 1 passed, 1 skipped, 4 warnings in 18.87 seconds ===============================================================
```

 @rahulunair could you take a look? Thanks! :)


Discussion:

Resolving patch:
diff --git a/tensorflow_addons/layers/poincare.py b/tensorflow_addons/layers/poincare.py
--- a/tensorflow_addons/layers/poincare.py
+++ b/tensorflow_addons/layers/poincare.py
@@ -16,6 +16,7 @@
 
 import tensorflow as tf
 from typeguard import typechecked
+from typing import Union, List
 
 
 @tf.keras.utils.register_keras_serializable(package="Addons")
@@ -43,7 +44,9 @@ class PoincareNormalize(tf.keras.layers.Layer):
     """
 
     @typechecked
-    def __init__(self, axis: int = 1, epsilon: float = 1e-5, **kwargs):
+    def __init__(
+        self, axis: Union[None, int, List[int]] = 1, epsilon: float = 1e-5, **kwargs
+    ):
         super().__init__(**kwargs)
         self.axis = axis
         self.epsilon = epsilon


Test patch:
diff --git a/tensorflow_addons/layers/poincare_test.py b/tensorflow_addons/layers/poincare_test.py
--- a/tensorflow_addons/layers/poincare_test.py
+++ b/tensorflow_addons/layers/poincare_test.py
@@ -55,7 +55,6 @@ def testPoincareNormalize(self):
                 self.assertLessEqual(norm.max(), 1.0 - epsilon + tol)
 
     def testPoincareNormalizeDimArray(self):
-        self.skipTest("Failing. See https://github.com/tensorflow/addons/issues/1205")
         x_shape = [20, 7, 3]
         epsilon = 1e-5
         tol = 1e-6