我具有以下theano功能
train_rbm = theano.function(
[index],
cost,
updates=updates,
givens={
x: train_set_x[index * batch_size: (index + 1) * batch_size]
},
name='train_rbm'
)
然后对于每个时期,我记录成本函数中的值
for epoch in range(training_epochs):
mean_cost = []
for batch_index in range(n_train_batches):
mean_cost += [train_rbm(batch_index)]
print('Training epoch %d, cost is ' % epoch, np.mean(mean_cost))
但是在进行训练时我得到了
Training epoch 0, cost is nan
Training epoch 1, cost is nan
是因为我的Theano函数没有任何输出吗?在这种情况下如何定义?
如果您需要参考来完成完整的源代码,我将关注this tutorial