在 TensorFlow 中使用实验的优势
Advantage of using experiments in TensorFlow
许多 TensorFlow 示例应用程序通过调用 tf.contrib.data.learn_runner.run
创建 Experiment
和 运行 Experiment
的方法之一。看起来 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
(and the derived classes) is a high-level API that hides matrix multiplications, saving checkpoints and so on, tf.contrib.learn.Experiment
tries to hide the boilerplate you'd need to do for distributed computation,即tf.train.ClusterSpec
、tf.train.Server
、工作、任务等
您可以在没有 Experiment
的单台机器上训练和评估 tf.estimator.Estimator
。请参阅 this tutorial.
中的示例
许多 TensorFlow 示例应用程序通过调用 tf.contrib.data.learn_runner.run
创建 Experiment
和 运行 Experiment
的方法之一。看起来 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
(and the derived classes) is a high-level API that hides matrix multiplications, saving checkpoints and so on, tf.contrib.learn.Experiment
tries to hide the boilerplate you'd need to do for distributed computation,即tf.train.ClusterSpec
、tf.train.Server
、工作、任务等
您可以在没有 Experiment
的单台机器上训练和评估 tf.estimator.Estimator
。请参阅 this tutorial.