From 025dc1d2a453196b80a5dd367cd724d7a9230a3f Mon Sep 17 00:00:00 2001 From: nl <3210346136@qq.com> Date: Sun, 16 May 2021 21:37:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=A9=E4=BB=A3=E7=A0=81=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E5=85=BC=E5=AE=B9=20tf1=20=E5=92=8C=20tf2=20=E7=9A=84?= =?UTF-8?q?=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpeechModel251.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SpeechModel251.py b/SpeechModel251.py index 6cb9bd1..f34a95e 100644 --- a/SpeechModel251.py +++ b/SpeechModel251.py @@ -342,8 +342,10 @@ class ModelSpeech(): # 语音模型类 r = K.ctc_decode(base_pred, in_len, greedy = True, beam_width=100, top_paths=1) #print('r', r) - #r1 = r[0][0].eval(session=tf.compat.v1.Session()) - r1 = r[0][0].numpy() + if(tf.__version__[0:2] == '1.'): + r1 = r[0][0].eval(session=tf.compat.v1.Session()) + else: + r1 = r[0][0].numpy() #tf.compat.v1.reset_default_graph() return r1[0]