有人可以帮助我了解以下代码中的每一行在做什么吗?我是 tensorflow 的新手并且非常困惑。
for epoch in range(training_epochs):
avg_cost = 0
total_batch = int(mnist.train.num_examples / batch_size)
for i in range(total_batch):
batch_xs, batch_ys = mnist.train.next_batch(batch_size)
c, _ = m1.train(batch_xs, batch_ys)
avg_cost += c / total_batch
print('Epoch:', '%04d' % (epoch + 1), 'cost =',
'{:.9f}'.format(avg_cost))
我已经定义了时代的数量。for循环内的代码通过training_epochs指定的迭代次数训练模型。
我不明白什么是什么batch_xs以及batch_ys为什么以及为什么mnist.train.next_batch(batch_size)返回的结果分别定义为batch_xs和的两个值batch_ys。
c, _ = m1.train(batch_xs, batch_ys)。c是多少,但底线是多少?
为什么每次迭代都会修改成本c / total_batch而不是c?
请帮助我理解。
狐的传说
有只小跳蛙
侃侃无极
随时随地看视频慕课网APP
相关分类