我使用的版本是 tensorflow-gpu 版本 2.1.0,从 pip 安装。
import tensorflow as tf
import tensorflow_hub as hub
tf.keras.backend.set_learning_phase(True)
module_url = "https://tfhub.dev/tensorflow/efficientnet/lite0/classification/2"
module2 = tf.keras.Sequential([
hub.KerasLayer(module_url, trainable=False, input_shape=(224,224,3))])
output1 = module2(tf.ones(shape=(1,224,224,3)))
print(module2.summary())
Run Code Online (Sandbox Code Playgroud)
当我设置时trainable = True,操作会报错。那么,我不能在 tf2.1 版本上重新训练它吗?