运行以下代码时,出现错误。有谁能帮助我吗?我正在使用 TensorFlow 2.1.0
import pandas as pd
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
print("GPU is", "available" if tf.test.is_gpu_available() else "NOT AVAILABLE")
tweets = pd.read_csv('dataset.csv')
print(tweets.columns)
labels = tweets[['Sentiment']]
tweets = tweets[['SentimentText']]
tweets = tweets['SentimentText'].to_numpy()
embed = hub.KerasLayer("./model", output_shape=[20], input_shape=[],dtype=tf.string)
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
with tf.compat.v1.Session() as sess:
sess.run([tf.compat.v1.global_variables_initializer()])
sess.run(embed(tweets))
我收到以下错误:
_override_gradient_function 中的文件“/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py”,第 4727 行,断言不是 self._gradient_function_map
断言错误