machine-learning - CNTK:在函数中找到 ValueError unbound 占位符

标签 machine-learning neural-network cntk

我正在使用 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/

相关文章:

neural-network - 为什么缩放数据在神经网络(LSTM)中非常重要

python - CNTK(微软认知工具包)导入错误

python - 支持 GPU 的 Python CNTK 2.0 在 Anaconda 3 4.4.0、Windows 10 Pro 64 位中似乎因 100% CPU 线程工作负载而挂起

python - Tensorflow 分类标签数据类型

python - 在宠物示例中实现自定义负对数似然损失时遇到问题

python - 有了 tensorflow ,我就有了图像信息的字典。如何训练这些图像中的特征?

r - 套索 : Cross-validation for glmnet

python - 将推文分类

python - 在 TensorFlow 中使用 MonitoredTrainingSession 与 Estimator 的原因是什么

java - 神经网络训练