ValueError:Tensor必须与带有(“ sub:0”,shape =(),dtype = float32)的Tensor来自同一张图

时间:2019-09-19 08:25:28

标签: jupyter-notebook anaconda python-3.6

model = Sequential()
model.add(Conv2D(filters = 6, kernel_size = 5, strides = 1,  activation = 'relu', input_shape = (32,32,3)))
model.add(MaxPooling2D(pool_size = 2, strides = 2))
model.add(Conv2D(filters = 16, kernel_size = 5,strides = 1, activation = 'relu',input_shape = (14,14,6)))
model.add(MaxPooling2D(pool_size = 2, strides = 2))
#Flatten
model.add(Flatten())
model.add(Dense(units = 120, activation = 'relu'))

model.add(密集(单位= 84,激活='relu'))

#Output Layer
model.add(Dense(units = 24, activation = 'softmax'))
# Compile the model with the optimizer:
model.compile(optimizer=indian, loss='categorical_crossentropy', metrics=['accuracy'])

训练网络:

epochs = 10 ; batchsize = 32
mod_h = model.fit(Xtrain, yTrain, batch_size=batchsize,

epochs = epochs,validation_data =(xtest,ytest),shuffle = True,verbose = 1)

model.summary()

输出显示错误

ValueError: Tensor("conv2d_1/kernel:0", shape=(5, 5, 3, 6), dtype=float32_ref) must be from the same graph as Tensor("sub:0", shape=(), dtype=float32).

0 个答案:

没有答案
相关问题