def markdown_table(step):
# The text summary can also contain Markdown, including Markdown
# tables. Markdown tables look like this:
#
# | hello | there |
# |-------|-------|
# | this | is |
# | a | table |
#
# The leading and trailing pipes in each row are optional, and the text
# doesn't actually have to be neatly aligned, so we can create these
# pretty easily. Let's do so.
header_row = 'Pounds of chocolate | Happiness'
chocolate = tf.range(step)
happiness = tf.square(chocolate + 1)
chocolate_column = tf.as_string(chocolate)
happiness_column = tf.as_string(happiness)
table_rows = tf.string_join([chocolate_column, " | ", happiness_column])
table_body = tf.reduce_join(table_rows, separator='\n')
table = tf.string_join([header_row, "---|---", table_body], separator='\n')
preamble = 'We conducted an experiment and found the following data:\n\n'
result = tf.string_join([preamble, table])
tf.summary.text('chocolate_study', result)
评论列表
文章目录