我正在使用 CNTK 并遇到以下错误:
ValueError: 2 unbound Placeholder(s) 'Placeholder('keep', [#, *], [939]), Placeholder('keep', [#, *], [939])' found in the Function. All Placeholders of a Function must be bound (to a variable) before performing a Forward computation.
for i in range(10000):
a1,a2,tar=get_sample(minibatch_size,start)
start=start+int(minibatch_size)
if start>=int(0.8*float(len(lab)))-minibatch_size:
start=0
trainer.train_minibatch({P1: a1, P2: a2, target: tar})
P1 and P2 are defined as C.layers.Input(939)
最佳答案
我能够找出我的案例中的问题。我必须将模型输出而不是模型本身作为参数传递给训练器构造函数。
模型 = cntk.layers.Sequential([l1,l2])
model_output = 模型(预测器)
错误: 训练器 = cntk.train.trainer.Trainer(模型,(损失,测量),[学习器])
没有错误: 训练器 = cntk.train.trainer.Trainer(model_output,(loss,meas),[learner])
关于machine-learning - CNTK:在函数中找到 ValueError unbound 占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43167511/