OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Debian 12 "Bookworm"
TensorFlow version and how it was installed (source or binary): pip install tensorflow==2.10
TensorFlow-Addons version and how it was installed (source or binary): pip install tensorfow-addons=0.19
Python version: 3.10
Is GPU used? (yes/no): yes
Describe the bug
When WeightNormalization layer is initialized, check_type_internal() function of typeguard used to make sure the object given to WeightNormalization is a tensorflow layer fails with the following traceback (see below). Tensorflow-addons installs the last typeguard which is 3.0.0 (released yesterday). If I fall back to 2.13.0 the problem dissapears.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[<ipython-input-6-973cec7abd8b>](https://localhost:8080/#) in <module>
1 # WeightNorm ConvNet
2 wn_model = tf.keras.Sequential([
----> 3 tfa.layers.WeightNormalization(tf.keras.layers.Conv2D(6, 5, activation='relu')),
4 tf.keras.layers.MaxPooling2D(2, 2),
5 tfa.layers.WeightNormalization(tf.keras.layers.Conv2D(16, 5, activation='relu')),
2 frames
[/usr/local/lib/python3.9/dist-packages/tensorflow_addons/layers/wrappers.py](https://localhost:8080/#) in __init__(self, layer, data_init, **kwargs)
57
58 @typechecked
---> 59 def __init__(self, layer: tf.keras.layers, data_init: bool = True, **kwargs):
60 super().__init__(layer, **kwargs)
61 self.data_init = data_init
[/usr/local/lib/python3.9/dist-packages/typeguard/_functions.py](https://localhost:8080/#) in check_argument_types(memo)
111 value = memo.arguments[argname]
112 try:
--> 113 check_type_internal(value, expected_type, memo=memo)
114 except TypeCheckError as exc:
115 qualname = qualified_name(value, add_class_prefix=True)
[/usr/local/lib/python3.9/dist-packages/typeguard/_checkers.py](https://localhost:8080/#) in check_type_internal(value, annotation, memo)
668 return
669
--> 670 if not isinstance(value, origin_type):
671 raise TypeCheckError(f"is not an instance of {qualified_name(origin_type)}")
672
TypeError: isinstance() arg 2 must be a type or tuple of types
System information
Describe the bug
When WeightNormalization layer is initialized,
check_type_internal()
function oftypeguard
used to make sure the object given to WeightNormalization is a tensorflow layer fails with the following traceback (see below). Tensorflow-addons installs the lasttypeguard
which is 3.0.0 (released yesterday). If I fall back to 2.13.0 the problem dissapears.Code to reproduce the issue
You can reproduce the code using example code on the tensorflow page. The error will be in the second cell under build models.
Other info / logs
It breaks here: