From 3cc13b92a070e1846e149ea7468218ae8cdd1df3 Mon Sep 17 00:00:00 2001 From: vankov Date: Fri, 26 Aug 2022 15:48:55 +0300 Subject: [PATCH] Fix static shape check in crd_decode When checking whether the shape of 'potentials' is static in crf_decode, you need to check whether potentials.shape[1].value is None, and not potentials.shape[1] (which is a Dimension object and is never equal to None). --- tensorflow_addons/text/crf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_addons/text/crf.py b/tensorflow_addons/text/crf.py index 3820b08a94..b6d0d99b84 100644 --- a/tensorflow_addons/text/crf.py +++ b/tensorflow_addons/text/crf.py @@ -582,7 +582,7 @@ def _multi_seq_fn(): best_score = tf.reduce_max(last_score, axis=1) return decode_tags, best_score - if potentials.shape[1] is not None: + if potentials.shape[1].value is not None: # shape is statically know, so we just execute # the appropriate code path if potentials.shape[1] == 1: