许多 TensorFlow 的示例应用程序创建 Experiment
s 并运行 Experiment
之一通过调用 tf.contrib.data.learn_runner.run
的方法.它看起来像一个 Experiment
本质上是 Estimator
的包装器.
创建和运行 Experiment
所需的代码看起来比创建、训练和评估 Estimator
所需的代码更复杂.我确信使用 Experiment
有好处s,但我不知道它是什么。有人可以帮我吗?
最佳答案
tf.contrib.learn.Experiment
是用于分布式训练的高级 API。这是来自它的文档:
Experiment is a class containing all information needed to train a model.
After an experiment is created (by passing an Estimator and inputs for training and evaluation), an Experiment instance knows how to invoke training and eval loops in a sensible fashion for distributed training.
就像 tf.estimator.Estimator
(和派生类)是隐藏矩阵乘法、保存检查点等的高级 API 一样,tf.contrib.learn.Experiment
试图隐藏您的样板文件d 需要为 distributed computation 做,即 tf.train.ClusterSpec
、tf.train.Server
、jobs、tasks 等
您可以在没有实验
的单台机器上训练和评估tf.estimator.Estimator
。请参阅 this tutorial 中的示例。
关于python - 在 TensorFlow 中使用实验的优势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47277279/