Reputation: 611
I'm trying to use this function to write a log text to the Tensorboard log file but I'm getting some troubles with this.
I want to write a list (or np.array) that contains strings. I can't just pass this as it's not a tensor, so how can I do this?
What I'm trying:
hyperparameters = ["learning_rate=1","batch_size=50","optimizer=Adagrad"]
summary_op = tf.summary.text("hyperparameters info", hyperparameters)
summary = session.run(summary_op )
writer.add_summary(summary)
Please take acount that that I already defined a FileWriter and I'm already running a session.
Upvotes: 2
Views: 1708
Reputation: 520
You can just use a tensor like that:
hyperparams = np.array(["learning_rate=1","batch_size=50","optimizer=Adagrad"])
hyperparams_tensor = tf.constant(hyperparams)
#Or Directly use the tensor, there is no need for np.array() or list
#hyperparams_tensor = tf.constant(["learning_rate=1","batch_size=50","optimizer=Adagrad"])
summary_op = tf.summary.text("hyperparameters info", hyperparams_tensor)
summary = session.run(summary_op)
writer.add_summary(summary)
Upvotes: 1