tobe
tobe

Reputation: 1741

How to run the example code of TensorFlow in distributed mode?

I'm new to TensorFlow and try to run it in distributed mode. Now I have found its official document in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/how_tos/distributed/index.md . But it lacks something in loss function.

Can anyone help to complete that so that I can run with your code?

Upvotes: 0

Views: 305

Answers (1)

nessuno
nessuno

Reputation: 27050

It not only lacks of loss function, it lacks of the model to train and thus the loss to minimize.

This file is just a template file that you have to complete in order to train your model in distributed mode.

So, when in the template file you find the comment

  # Build model...

It means that you have to define a model to train (eg: a convolutional neural network, a simple perceptron...). Something like the MNIST model that you can find in the tutorial: https://www.tensorflow.org/versions/r0.9/tutorials/mnist/beginners/index.html

Your model ends with a loss function to minimize.

Following the MNIST example, the loss is:

cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
loss = cross_entropy

Once you defined the model to train and the loss to minimize, you have filled the template with the missing values and you can now start to train you model in distributed mode.

Upvotes: 3

Related Questions