我正在构建Keras模型,并且定义了一个包含它的类。我需要以类似self.stored_input = input_of_the_model的方式“存储”模型的输入
我使用的是Python 3.6.7,Tensorflow 2.1.6和Keras 2.2.4,我做了一个初步的尝试,但效果不佳。这就是我要做的:
'''
类自动编码器: def init (自己,input_shape = [224,224]):
self.models_dir = '../model'
# Input
img = Input(shape=(224, 224, 1))
..... Convolutional neural network layers here.....
self.img = img
'''
我想在AutoEncoder类的函数中使用self.img,但使用该错误时会出现此错误:
InvalidArgumentError:您必须使用dtype float和形状[?,224,224,1]的占位符张量'input_1'输入值。 [[{{node input_1}} = Placeholderdtype = DT_FLOAT,shape = [?, 224,224,1],_ device =“ / job:localhost /副本:0 / task:0 / device:CPU:0”]]