Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions greeter_plugin/greeter_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,22 @@ def op(name,
if display_name is None:
display_name = name


summary_metadata = tf.SummaryMetadata()
# We could put additional metadata other than the PLUGIN_NAME,
# but we don't need any metadata for this simple example.
summary_metadata.plugin_data.add(plugin_name=PLUGIN_NAME, content="")
summary_metadata = tf.SummaryMetadata(
display_name=display_name,
summary_description=description,
plugin_data=tf.SummaryMetadata.PluginData(
plugin_name=PLUGIN_NAME,
content=''))

message = tf.string_join(['Hello, ', guest, '!'])

# Return a summary op that is properly configured.
return tf.summary.tensor_summary(
name,
message,
display_name=display_name,
summary_metadata=summary_metadata,
summary_description=description,
collections=collections)


Expand All @@ -81,17 +84,19 @@ def pb(tag, guest, display_name=None, description=None):
message = 'Hello, %s!' % guest
tensor = tf.make_tensor_proto(message, dtype=tf.string)

summary_metadata = tf.SummaryMetadata(display_name=display_name,
summary_description=description)
# We have no metadata to store, but we do need to add a plugin_data entry
# so that we know this summary is associated with the greeter plugin.
metadata_content = '{}'
summary_metadata.plugin_data.add(plugin_name=PLUGIN_NAME,
content=metadata_content)
summary_metadata = tf.SummaryMetadata(
display_name=display_name,
summary_description=description,
plugin_data=tf.SummaryMetadata.PluginData(
plugin_name=PLUGIN_NAME,
content=metadata_content))

summary = tf.Summary()
summary.value.add(tag=tag,
metadata=summary_metadata,
tensor=tensor)
return summary