how to write summary in distributied tensorflow?
I have tried servral methods to write summary in distributied tensorflow setting, but all of them failed. my last try failed with
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float
Following is my code:
if arguments.job_name == "ps":
server.join()
elif arguments.job_name == "worker":
is_chief = (arguments.task_index == 0)
with tf.device(tf.train.replica_device_setter(worker_device="/job:worker/task:%d" % arguments.task_index,
cluster=cluster)):
x = tf.placeholder(tf.float32, shape=(None, feature_num), name="input_x")
y = tf.placeholder(tf.float32, shape=(None, 1), name="input_y")
w = tf.get_variable("weight", (feature_num, 1), initializer=tf.random_normal_initializer())
b = tf.get_variable("bais", (1, 1), initializer=tf.constant_initializer(0.0))
p_y = tf.add(tf.matmul(x, w), b)
loss = tf.reduce_sum(tf.square(y - p_y), name="loss")
global_step = tf.contrib.framework.get_or_create_global_step()
opt = tf.train.GradientDescentOptimizer(learning_rate=0.0000001)
training_op = opt.minimize(loss, global_step=global_step)
tf.summary.scalar("loss",loss)
summary_op = tf.summary.merge_all()
summary_hook = tf.train.SummarySaverHook(save_secs=1, output_dir="./summary", summary_op=summary_op)
with tf.train.MonitoredTrainingSession(master=server.target,
is_chief=is_chief,
hooks=[summary_hook],save_summaries_secs=None,save_summaries_steps=None,
checkpoint_dir="./model",save_checkpoint_secs=5) as mon_sess:
for (x_data, y_data) in dataSet:
if not mon_sess.should_stop():
print("============training...=====================")
mon_sess.run(training_op, feed_dict={x: x_data, y: y_data})
mon_sess.run(summary_op, feed_dict={x: x_data, y: y_data})
print("finised!!!!")
can anybody give help?
tensorflow distributed
add a comment |
I have tried servral methods to write summary in distributied tensorflow setting, but all of them failed. my last try failed with
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float
Following is my code:
if arguments.job_name == "ps":
server.join()
elif arguments.job_name == "worker":
is_chief = (arguments.task_index == 0)
with tf.device(tf.train.replica_device_setter(worker_device="/job:worker/task:%d" % arguments.task_index,
cluster=cluster)):
x = tf.placeholder(tf.float32, shape=(None, feature_num), name="input_x")
y = tf.placeholder(tf.float32, shape=(None, 1), name="input_y")
w = tf.get_variable("weight", (feature_num, 1), initializer=tf.random_normal_initializer())
b = tf.get_variable("bais", (1, 1), initializer=tf.constant_initializer(0.0))
p_y = tf.add(tf.matmul(x, w), b)
loss = tf.reduce_sum(tf.square(y - p_y), name="loss")
global_step = tf.contrib.framework.get_or_create_global_step()
opt = tf.train.GradientDescentOptimizer(learning_rate=0.0000001)
training_op = opt.minimize(loss, global_step=global_step)
tf.summary.scalar("loss",loss)
summary_op = tf.summary.merge_all()
summary_hook = tf.train.SummarySaverHook(save_secs=1, output_dir="./summary", summary_op=summary_op)
with tf.train.MonitoredTrainingSession(master=server.target,
is_chief=is_chief,
hooks=[summary_hook],save_summaries_secs=None,save_summaries_steps=None,
checkpoint_dir="./model",save_checkpoint_secs=5) as mon_sess:
for (x_data, y_data) in dataSet:
if not mon_sess.should_stop():
print("============training...=====================")
mon_sess.run(training_op, feed_dict={x: x_data, y: y_data})
mon_sess.run(summary_op, feed_dict={x: x_data, y: y_data})
print("finised!!!!")
can anybody give help?
tensorflow distributed
add a comment |
I have tried servral methods to write summary in distributied tensorflow setting, but all of them failed. my last try failed with
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float
Following is my code:
if arguments.job_name == "ps":
server.join()
elif arguments.job_name == "worker":
is_chief = (arguments.task_index == 0)
with tf.device(tf.train.replica_device_setter(worker_device="/job:worker/task:%d" % arguments.task_index,
cluster=cluster)):
x = tf.placeholder(tf.float32, shape=(None, feature_num), name="input_x")
y = tf.placeholder(tf.float32, shape=(None, 1), name="input_y")
w = tf.get_variable("weight", (feature_num, 1), initializer=tf.random_normal_initializer())
b = tf.get_variable("bais", (1, 1), initializer=tf.constant_initializer(0.0))
p_y = tf.add(tf.matmul(x, w), b)
loss = tf.reduce_sum(tf.square(y - p_y), name="loss")
global_step = tf.contrib.framework.get_or_create_global_step()
opt = tf.train.GradientDescentOptimizer(learning_rate=0.0000001)
training_op = opt.minimize(loss, global_step=global_step)
tf.summary.scalar("loss",loss)
summary_op = tf.summary.merge_all()
summary_hook = tf.train.SummarySaverHook(save_secs=1, output_dir="./summary", summary_op=summary_op)
with tf.train.MonitoredTrainingSession(master=server.target,
is_chief=is_chief,
hooks=[summary_hook],save_summaries_secs=None,save_summaries_steps=None,
checkpoint_dir="./model",save_checkpoint_secs=5) as mon_sess:
for (x_data, y_data) in dataSet:
if not mon_sess.should_stop():
print("============training...=====================")
mon_sess.run(training_op, feed_dict={x: x_data, y: y_data})
mon_sess.run(summary_op, feed_dict={x: x_data, y: y_data})
print("finised!!!!")
can anybody give help?
tensorflow distributed
I have tried servral methods to write summary in distributied tensorflow setting, but all of them failed. my last try failed with
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float
Following is my code:
if arguments.job_name == "ps":
server.join()
elif arguments.job_name == "worker":
is_chief = (arguments.task_index == 0)
with tf.device(tf.train.replica_device_setter(worker_device="/job:worker/task:%d" % arguments.task_index,
cluster=cluster)):
x = tf.placeholder(tf.float32, shape=(None, feature_num), name="input_x")
y = tf.placeholder(tf.float32, shape=(None, 1), name="input_y")
w = tf.get_variable("weight", (feature_num, 1), initializer=tf.random_normal_initializer())
b = tf.get_variable("bais", (1, 1), initializer=tf.constant_initializer(0.0))
p_y = tf.add(tf.matmul(x, w), b)
loss = tf.reduce_sum(tf.square(y - p_y), name="loss")
global_step = tf.contrib.framework.get_or_create_global_step()
opt = tf.train.GradientDescentOptimizer(learning_rate=0.0000001)
training_op = opt.minimize(loss, global_step=global_step)
tf.summary.scalar("loss",loss)
summary_op = tf.summary.merge_all()
summary_hook = tf.train.SummarySaverHook(save_secs=1, output_dir="./summary", summary_op=summary_op)
with tf.train.MonitoredTrainingSession(master=server.target,
is_chief=is_chief,
hooks=[summary_hook],save_summaries_secs=None,save_summaries_steps=None,
checkpoint_dir="./model",save_checkpoint_secs=5) as mon_sess:
for (x_data, y_data) in dataSet:
if not mon_sess.should_stop():
print("============training...=====================")
mon_sess.run(training_op, feed_dict={x: x_data, y: y_data})
mon_sess.run(summary_op, feed_dict={x: x_data, y: y_data})
print("finised!!!!")
can anybody give help?
tensorflow distributed
tensorflow distributed
edited Jan 2 at 1:13
jianjunwu
asked Jan 1 at 12:29
jianjunwujianjunwu
12
12
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995435%2fhow-to-write-summary-in-distributied-tensorflow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995435%2fhow-to-write-summary-in-distributied-tensorflow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown