partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | pb | Create a legacy text summary protobuf.
Arguments:
name: A name for the generated node. Will also serve as a series name in
TensorBoard.
data: A Python bytestring (of type bytes), or Unicode string. Or a numpy
data array of those types.
display_name: Optional name for this summary in TensorBoa... | tensorboard/plugins/text/summary.py | def pb(name, data, display_name=None, description=None):
"""Create a legacy text summary protobuf.
Arguments:
name: A name for the generated node. Will also serve as a series name in
TensorBoard.
data: A Python bytestring (of type bytes), or Unicode string. Or a numpy
data array of those types.... | def pb(name, data, display_name=None, description=None):
"""Create a legacy text summary protobuf.
Arguments:
name: A name for the generated node. Will also serve as a series name in
TensorBoard.
data: A Python bytestring (of type bytes), or Unicode string. Or a numpy
data array of those types.... | [
"Create",
"a",
"legacy",
"text",
"summary",
"protobuf",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/text/summary.py#L79-L116 | [
"def",
"pb",
"(",
"name",
",",
"data",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"# TODO(nickfelt): remove on-demand imports once dep situation is fixed.",
"import",
"tensorflow",
".",
"compat",
".",
"v1",
"as",
"tf",
"try",
":",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _GetPurgeMessage | Return the string message associated with TensorBoard purges. | tensorboard/backend/event_processing/event_accumulator.py | def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step,
event_wall_time, num_expired_scalars, num_expired_histos,
num_expired_comp_histos, num_expired_images,
num_expired_audio):
"""Return the string message associated with TensorBoard p... | def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step,
event_wall_time, num_expired_scalars, num_expired_histos,
num_expired_comp_histos, num_expired_images,
num_expired_audio):
"""Return the string message associated with TensorBoard p... | [
"Return",
"the",
"string",
"message",
"associated",
"with",
"TensorBoard",
"purges",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L719-L733 | [
"def",
"_GetPurgeMessage",
"(",
"most_recent_step",
",",
"most_recent_wall_time",
",",
"event_step",
",",
"event_wall_time",
",",
"num_expired_scalars",
",",
"num_expired_histos",
",",
"num_expired_comp_histos",
",",
"num_expired_images",
",",
"num_expired_audio",
")",
":",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _GeneratorFromPath | Create an event generator for file or directory at given path string. | tensorboard/backend/event_processing/event_accumulator.py | def _GeneratorFromPath(path):
"""Create an event generator for file or directory at given path string."""
if not path:
raise ValueError('path must be a valid string')
if io_wrapper.IsTensorFlowEventsFile(path):
return event_file_loader.EventFileLoader(path)
else:
return directory_watcher.DirectoryWa... | def _GeneratorFromPath(path):
"""Create an event generator for file or directory at given path string."""
if not path:
raise ValueError('path must be a valid string')
if io_wrapper.IsTensorFlowEventsFile(path):
return event_file_loader.EventFileLoader(path)
else:
return directory_watcher.DirectoryWa... | [
"Create",
"an",
"event",
"generator",
"for",
"file",
"or",
"directory",
"at",
"given",
"path",
"string",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L736-L746 | [
"def",
"_GeneratorFromPath",
"(",
"path",
")",
":",
"if",
"not",
"path",
":",
"raise",
"ValueError",
"(",
"'path must be a valid string'",
")",
"if",
"io_wrapper",
".",
"IsTensorFlowEventsFile",
"(",
"path",
")",
":",
"return",
"event_file_loader",
".",
"EventFile... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _ParseFileVersion | Convert the string file_version in event.proto into a float.
Args:
file_version: String file_version from event.proto
Returns:
Version number as a float. | tensorboard/backend/event_processing/event_accumulator.py | def _ParseFileVersion(file_version):
"""Convert the string file_version in event.proto into a float.
Args:
file_version: String file_version from event.proto
Returns:
Version number as a float.
"""
tokens = file_version.split('brain.Event:')
try:
return float(tokens[-1])
except ValueError:
... | def _ParseFileVersion(file_version):
"""Convert the string file_version in event.proto into a float.
Args:
file_version: String file_version from event.proto
Returns:
Version number as a float.
"""
tokens = file_version.split('brain.Event:')
try:
return float(tokens[-1])
except ValueError:
... | [
"Convert",
"the",
"string",
"file_version",
"in",
"event",
".",
"proto",
"into",
"a",
"float",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L749-L767 | [
"def",
"_ParseFileVersion",
"(",
"file_version",
")",
":",
"tokens",
"=",
"file_version",
".",
"split",
"(",
"'brain.Event:'",
")",
"try",
":",
"return",
"float",
"(",
"tokens",
"[",
"-",
"1",
"]",
")",
"except",
"ValueError",
":",
"## This should never happen... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.Reload | Loads all events added since the last call to `Reload`.
If `Reload` was never called, loads all events in the file.
Returns:
The `EventAccumulator`. | tensorboard/backend/event_processing/event_accumulator.py | def Reload(self):
"""Loads all events added since the last call to `Reload`.
If `Reload` was never called, loads all events in the file.
Returns:
The `EventAccumulator`.
"""
with self._generator_mutex:
for event in self._generator.Load():
self._ProcessEvent(event)
return se... | def Reload(self):
"""Loads all events added since the last call to `Reload`.
If `Reload` was never called, loads all events in the file.
Returns:
The `EventAccumulator`.
"""
with self._generator_mutex:
for event in self._generator.Load():
self._ProcessEvent(event)
return se... | [
"Loads",
"all",
"events",
"added",
"since",
"the",
"last",
"call",
"to",
"Reload",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L220-L231 | [
"def",
"Reload",
"(",
"self",
")",
":",
"with",
"self",
".",
"_generator_mutex",
":",
"for",
"event",
"in",
"self",
".",
"_generator",
".",
"Load",
"(",
")",
":",
"self",
".",
"_ProcessEvent",
"(",
"event",
")",
"return",
"self"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.RetrievePluginAsset | Return the contents of a given plugin asset.
Args:
plugin_name: The string name of a plugin.
asset_name: The string name of an asset.
Returns:
The string contents of the plugin asset.
Raises:
KeyError: If the asset is not available. | tensorboard/backend/event_processing/event_accumulator.py | def RetrievePluginAsset(self, plugin_name, asset_name):
"""Return the contents of a given plugin asset.
Args:
plugin_name: The string name of a plugin.
asset_name: The string name of an asset.
Returns:
The string contents of the plugin asset.
Raises:
KeyError: If the asset is ... | def RetrievePluginAsset(self, plugin_name, asset_name):
"""Return the contents of a given plugin asset.
Args:
plugin_name: The string name of a plugin.
asset_name: The string name of an asset.
Returns:
The string contents of the plugin asset.
Raises:
KeyError: If the asset is ... | [
"Return",
"the",
"contents",
"of",
"a",
"given",
"plugin",
"asset",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L245-L258 | [
"def",
"RetrievePluginAsset",
"(",
"self",
",",
"plugin_name",
",",
"asset_name",
")",
":",
"return",
"plugin_asset_util",
".",
"RetrieveAsset",
"(",
"self",
".",
"path",
",",
"plugin_name",
",",
"asset_name",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.FirstEventTimestamp | Returns the timestamp in seconds of the first event.
If the first event has been loaded (either by this method or by `Reload`,
this returns immediately. Otherwise, it will load in the first event. Note
that this means that calling `Reload` will cause this to block until
`Reload` has finished.
Retu... | tensorboard/backend/event_processing/event_accumulator.py | def FirstEventTimestamp(self):
"""Returns the timestamp in seconds of the first event.
If the first event has been loaded (either by this method or by `Reload`,
this returns immediately. Otherwise, it will load in the first event. Note
that this means that calling `Reload` will cause this to block unti... | def FirstEventTimestamp(self):
"""Returns the timestamp in seconds of the first event.
If the first event has been loaded (either by this method or by `Reload`,
this returns immediately. Otherwise, it will load in the first event. Note
that this means that calling `Reload` will cause this to block unti... | [
"Returns",
"the",
"timestamp",
"in",
"seconds",
"of",
"the",
"first",
"event",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L260-L284 | [
"def",
"FirstEventTimestamp",
"(",
"self",
")",
":",
"if",
"self",
".",
"_first_event_timestamp",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_first_event_timestamp",
"with",
"self",
".",
"_generator_mutex",
":",
"try",
":",
"event",
"=",
"next",
"(",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.PluginTagToContent | Returns a dict mapping tags to content specific to that plugin.
Args:
plugin_name: The name of the plugin for which to fetch plugin-specific
content.
Raises:
KeyError: if the plugin name is not found.
Returns:
A dict mapping tags to plugin-specific content (which are always stri... | tensorboard/backend/event_processing/event_accumulator.py | def PluginTagToContent(self, plugin_name):
"""Returns a dict mapping tags to content specific to that plugin.
Args:
plugin_name: The name of the plugin for which to fetch plugin-specific
content.
Raises:
KeyError: if the plugin name is not found.
Returns:
A dict mapping tags... | def PluginTagToContent(self, plugin_name):
"""Returns a dict mapping tags to content specific to that plugin.
Args:
plugin_name: The name of the plugin for which to fetch plugin-specific
content.
Raises:
KeyError: if the plugin name is not found.
Returns:
A dict mapping tags... | [
"Returns",
"a",
"dict",
"mapping",
"tags",
"to",
"content",
"specific",
"to",
"that",
"plugin",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L286-L302 | [
"def",
"PluginTagToContent",
"(",
"self",
",",
"plugin_name",
")",
":",
"if",
"plugin_name",
"not",
"in",
"self",
".",
"_plugin_to_tag_to_content",
":",
"raise",
"KeyError",
"(",
"'Plugin %r could not be found.'",
"%",
"plugin_name",
")",
"return",
"self",
".",
"_... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.Tags | Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary. | tensorboard/backend/event_processing/event_accumulator.py | def Tags(self):
"""Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary.
"""
return {
IMAGES: self.images.Keys(),
AUDIO: self.audios.Keys(),
HISTOGRAMS: self.histograms.Keys(),
SCALARS: self.scalars.Keys(),
CO... | def Tags(self):
"""Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary.
"""
return {
IMAGES: self.images.Keys(),
AUDIO: self.audios.Keys(),
HISTOGRAMS: self.histograms.Keys(),
SCALARS: self.scalars.Keys(),
CO... | [
"Return",
"all",
"tags",
"found",
"in",
"the",
"value",
"stream",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L406-L424 | [
"def",
"Tags",
"(",
"self",
")",
":",
"return",
"{",
"IMAGES",
":",
"self",
".",
"images",
".",
"Keys",
"(",
")",
",",
"AUDIO",
":",
"self",
".",
"audios",
".",
"Keys",
"(",
")",
",",
"HISTOGRAMS",
":",
"self",
".",
"histograms",
".",
"Keys",
"("... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.Graph | Return the graph definition, if there is one.
If the graph is stored directly, return that. If no graph is stored
directly but a metagraph is stored containing a graph, return that.
Raises:
ValueError: If there is no graph for this run.
Returns:
The `graph_def` proto. | tensorboard/backend/event_processing/event_accumulator.py | def Graph(self):
"""Return the graph definition, if there is one.
If the graph is stored directly, return that. If no graph is stored
directly but a metagraph is stored containing a graph, return that.
Raises:
ValueError: If there is no graph for this run.
Returns:
The `graph_def` pr... | def Graph(self):
"""Return the graph definition, if there is one.
If the graph is stored directly, return that. If no graph is stored
directly but a metagraph is stored containing a graph, return that.
Raises:
ValueError: If there is no graph for this run.
Returns:
The `graph_def` pr... | [
"Return",
"the",
"graph",
"definition",
"if",
"there",
"is",
"one",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L440-L456 | [
"def",
"Graph",
"(",
"self",
")",
":",
"graph",
"=",
"graph_pb2",
".",
"GraphDef",
"(",
")",
"if",
"self",
".",
"_graph",
"is",
"not",
"None",
":",
"graph",
".",
"ParseFromString",
"(",
"self",
".",
"_graph",
")",
"return",
"graph",
"raise",
"ValueErro... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.MetaGraph | Return the metagraph definition, if there is one.
Raises:
ValueError: If there is no metagraph for this run.
Returns:
The `meta_graph_def` proto. | tensorboard/backend/event_processing/event_accumulator.py | def MetaGraph(self):
"""Return the metagraph definition, if there is one.
Raises:
ValueError: If there is no metagraph for this run.
Returns:
The `meta_graph_def` proto.
"""
if self._meta_graph is None:
raise ValueError('There is no metagraph in this EventAccumulator')
meta_g... | def MetaGraph(self):
"""Return the metagraph definition, if there is one.
Raises:
ValueError: If there is no metagraph for this run.
Returns:
The `meta_graph_def` proto.
"""
if self._meta_graph is None:
raise ValueError('There is no metagraph in this EventAccumulator')
meta_g... | [
"Return",
"the",
"metagraph",
"definition",
"if",
"there",
"is",
"one",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L458-L471 | [
"def",
"MetaGraph",
"(",
"self",
")",
":",
"if",
"self",
".",
"_meta_graph",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'There is no metagraph in this EventAccumulator'",
")",
"meta_graph",
"=",
"meta_graph_pb2",
".",
"MetaGraphDef",
"(",
")",
"meta_graph",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.RunMetadata | Given a tag, return the associated session.run() metadata.
Args:
tag: A string tag associated with the event.
Raises:
ValueError: If the tag is not found.
Returns:
The metadata in form of `RunMetadata` proto. | tensorboard/backend/event_processing/event_accumulator.py | def RunMetadata(self, tag):
"""Given a tag, return the associated session.run() metadata.
Args:
tag: A string tag associated with the event.
Raises:
ValueError: If the tag is not found.
Returns:
The metadata in form of `RunMetadata` proto.
"""
if tag not in self._tagged_meta... | def RunMetadata(self, tag):
"""Given a tag, return the associated session.run() metadata.
Args:
tag: A string tag associated with the event.
Raises:
ValueError: If the tag is not found.
Returns:
The metadata in form of `RunMetadata` proto.
"""
if tag not in self._tagged_meta... | [
"Given",
"a",
"tag",
"return",
"the",
"associated",
"session",
".",
"run",
"()",
"metadata",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L473-L490 | [
"def",
"RunMetadata",
"(",
"self",
",",
"tag",
")",
":",
"if",
"tag",
"not",
"in",
"self",
".",
"_tagged_metadata",
":",
"raise",
"ValueError",
"(",
"'There is no run metadata with this tag name'",
")",
"run_metadata",
"=",
"config_pb2",
".",
"RunMetadata",
"(",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._MaybePurgeOrphanedData | Maybe purge orphaned data due to a TensorFlow crash.
When TensorFlow crashes at step T+O and restarts at step T, any events
written after step T are now "orphaned" and will be at best misleading if
they are included in TensorBoard.
This logic attempts to determine if there is orphaned data, and purge ... | tensorboard/backend/event_processing/event_accumulator.py | def _MaybePurgeOrphanedData(self, event):
"""Maybe purge orphaned data due to a TensorFlow crash.
When TensorFlow crashes at step T+O and restarts at step T, any events
written after step T are now "orphaned" and will be at best misleading if
they are included in TensorBoard.
This logic attempts t... | def _MaybePurgeOrphanedData(self, event):
"""Maybe purge orphaned data due to a TensorFlow crash.
When TensorFlow crashes at step T+O and restarts at step T, any events
written after step T are now "orphaned" and will be at best misleading if
they are included in TensorBoard.
This logic attempts t... | [
"Maybe",
"purge",
"orphaned",
"data",
"due",
"to",
"a",
"TensorFlow",
"crash",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L562-L585 | [
"def",
"_MaybePurgeOrphanedData",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"purge_orphaned_data",
":",
"return",
"## Check if the event happened after a crash, and purge expired tags.",
"if",
"self",
".",
"file_version",
"and",
"self",
".",
"file_v... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._CheckForRestartAndMaybePurge | Check and discard expired events using SessionLog.START.
Check for a SessionLog.START event and purge all previously seen events
with larger steps, because they are out of date. Because of supervisor
threading, it is possible that this logic will cause the first few event
messages to be discarded since... | tensorboard/backend/event_processing/event_accumulator.py | def _CheckForRestartAndMaybePurge(self, event):
"""Check and discard expired events using SessionLog.START.
Check for a SessionLog.START event and purge all previously seen events
with larger steps, because they are out of date. Because of supervisor
threading, it is possible that this logic will cause... | def _CheckForRestartAndMaybePurge(self, event):
"""Check and discard expired events using SessionLog.START.
Check for a SessionLog.START event and purge all previously seen events
with larger steps, because they are out of date. Because of supervisor
threading, it is possible that this logic will cause... | [
"Check",
"and",
"discard",
"expired",
"events",
"using",
"SessionLog",
".",
"START",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L587-L605 | [
"def",
"_CheckForRestartAndMaybePurge",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"HasField",
"(",
"'session_log'",
")",
"and",
"event",
".",
"session_log",
".",
"status",
"==",
"event_pb2",
".",
"SessionLog",
".",
"START",
":",
"self",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._CheckForOutOfOrderStepAndMaybePurge | Check for out-of-order event.step and discard expired events for tags.
Check if the event is out of order relative to the global most recent step.
If it is, purge outdated summaries for tags that the event contains.
Args:
event: The event to use as reference. If the event is out-of-order, all
... | tensorboard/backend/event_processing/event_accumulator.py | def _CheckForOutOfOrderStepAndMaybePurge(self, event):
"""Check for out-of-order event.step and discard expired events for tags.
Check if the event is out of order relative to the global most recent step.
If it is, purge outdated summaries for tags that the event contains.
Args:
event: The event... | def _CheckForOutOfOrderStepAndMaybePurge(self, event):
"""Check for out-of-order event.step and discard expired events for tags.
Check if the event is out of order relative to the global most recent step.
If it is, purge outdated summaries for tags that the event contains.
Args:
event: The event... | [
"Check",
"for",
"out",
"-",
"of",
"-",
"order",
"event",
".",
"step",
"and",
"discard",
"expired",
"events",
"for",
"tags",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L607-L621 | [
"def",
"_CheckForOutOfOrderStepAndMaybePurge",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"step",
"<",
"self",
".",
"most_recent_step",
"and",
"event",
".",
"HasField",
"(",
"'summary'",
")",
":",
"self",
".",
"_Purge",
"(",
"event",
",",
"by... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._ProcessHistogram | Processes a proto histogram by adding it to accumulated state. | tensorboard/backend/event_processing/event_accumulator.py | def _ProcessHistogram(self, tag, wall_time, step, histo):
"""Processes a proto histogram by adding it to accumulated state."""
histo = self._ConvertHistogramProtoToTuple(histo)
histo_ev = HistogramEvent(wall_time, step, histo)
self.histograms.AddItem(tag, histo_ev)
self.compressed_histograms.AddItem... | def _ProcessHistogram(self, tag, wall_time, step, histo):
"""Processes a proto histogram by adding it to accumulated state."""
histo = self._ConvertHistogramProtoToTuple(histo)
histo_ev = HistogramEvent(wall_time, step, histo)
self.histograms.AddItem(tag, histo_ev)
self.compressed_histograms.AddItem... | [
"Processes",
"a",
"proto",
"histogram",
"by",
"adding",
"it",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L632-L637 | [
"def",
"_ProcessHistogram",
"(",
"self",
",",
"tag",
",",
"wall_time",
",",
"step",
",",
"histo",
")",
":",
"histo",
"=",
"self",
".",
"_ConvertHistogramProtoToTuple",
"(",
"histo",
")",
"histo_ev",
"=",
"HistogramEvent",
"(",
"wall_time",
",",
"step",
",",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._CompressHistogram | Callback for _ProcessHistogram. | tensorboard/backend/event_processing/event_accumulator.py | def _CompressHistogram(self, histo_ev):
"""Callback for _ProcessHistogram."""
return CompressedHistogramEvent(
histo_ev.wall_time,
histo_ev.step,
compressor.compress_histogram_proto(
histo_ev.histogram_value, self._compression_bps)) | def _CompressHistogram(self, histo_ev):
"""Callback for _ProcessHistogram."""
return CompressedHistogramEvent(
histo_ev.wall_time,
histo_ev.step,
compressor.compress_histogram_proto(
histo_ev.histogram_value, self._compression_bps)) | [
"Callback",
"for",
"_ProcessHistogram",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L639-L645 | [
"def",
"_CompressHistogram",
"(",
"self",
",",
"histo_ev",
")",
":",
"return",
"CompressedHistogramEvent",
"(",
"histo_ev",
".",
"wall_time",
",",
"histo_ev",
".",
"step",
",",
"compressor",
".",
"compress_histogram_proto",
"(",
"histo_ev",
".",
"histogram_value",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._ProcessImage | Processes an image by adding it to accumulated state. | tensorboard/backend/event_processing/event_accumulator.py | def _ProcessImage(self, tag, wall_time, step, image):
"""Processes an image by adding it to accumulated state."""
event = ImageEvent(wall_time=wall_time,
step=step,
encoded_image_string=image.encoded_image_string,
width=image.width,
... | def _ProcessImage(self, tag, wall_time, step, image):
"""Processes an image by adding it to accumulated state."""
event = ImageEvent(wall_time=wall_time,
step=step,
encoded_image_string=image.encoded_image_string,
width=image.width,
... | [
"Processes",
"an",
"image",
"by",
"adding",
"it",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L647-L654 | [
"def",
"_ProcessImage",
"(",
"self",
",",
"tag",
",",
"wall_time",
",",
"step",
",",
"image",
")",
":",
"event",
"=",
"ImageEvent",
"(",
"wall_time",
"=",
"wall_time",
",",
"step",
"=",
"step",
",",
"encoded_image_string",
"=",
"image",
".",
"encoded_image... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._ProcessAudio | Processes a audio by adding it to accumulated state. | tensorboard/backend/event_processing/event_accumulator.py | def _ProcessAudio(self, tag, wall_time, step, audio):
"""Processes a audio by adding it to accumulated state."""
event = AudioEvent(wall_time=wall_time,
step=step,
encoded_audio_string=audio.encoded_audio_string,
content_type=audio.content_typ... | def _ProcessAudio(self, tag, wall_time, step, audio):
"""Processes a audio by adding it to accumulated state."""
event = AudioEvent(wall_time=wall_time,
step=step,
encoded_audio_string=audio.encoded_audio_string,
content_type=audio.content_typ... | [
"Processes",
"a",
"audio",
"by",
"adding",
"it",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L656-L664 | [
"def",
"_ProcessAudio",
"(",
"self",
",",
"tag",
",",
"wall_time",
",",
"step",
",",
"audio",
")",
":",
"event",
"=",
"AudioEvent",
"(",
"wall_time",
"=",
"wall_time",
",",
"step",
"=",
"step",
",",
"encoded_audio_string",
"=",
"audio",
".",
"encoded_audio... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._ProcessScalar | Processes a simple value by adding it to accumulated state. | tensorboard/backend/event_processing/event_accumulator.py | def _ProcessScalar(self, tag, wall_time, step, scalar):
"""Processes a simple value by adding it to accumulated state."""
sv = ScalarEvent(wall_time=wall_time, step=step, value=scalar)
self.scalars.AddItem(tag, sv) | def _ProcessScalar(self, tag, wall_time, step, scalar):
"""Processes a simple value by adding it to accumulated state."""
sv = ScalarEvent(wall_time=wall_time, step=step, value=scalar)
self.scalars.AddItem(tag, sv) | [
"Processes",
"a",
"simple",
"value",
"by",
"adding",
"it",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L666-L669 | [
"def",
"_ProcessScalar",
"(",
"self",
",",
"tag",
",",
"wall_time",
",",
"step",
",",
"scalar",
")",
":",
"sv",
"=",
"ScalarEvent",
"(",
"wall_time",
"=",
"wall_time",
",",
"step",
"=",
"step",
",",
"value",
"=",
"scalar",
")",
"self",
".",
"scalars",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._Purge | Purge all events that have occurred after the given event.step.
If by_tags is True, purge all events that occurred after the given
event.step, but only for the tags that the event has. Non-sequential
event.steps suggest that a TensorFlow restart occurred, and we discard
the out-of-order events to displ... | tensorboard/backend/event_processing/event_accumulator.py | def _Purge(self, event, by_tags):
"""Purge all events that have occurred after the given event.step.
If by_tags is True, purge all events that occurred after the given
event.step, but only for the tags that the event has. Non-sequential
event.steps suggest that a TensorFlow restart occurred, and we dis... | def _Purge(self, event, by_tags):
"""Purge all events that have occurred after the given event.step.
If by_tags is True, purge all events that occurred after the given
event.step, but only for the tags that the event has. Non-sequential
event.steps suggest that a TensorFlow restart occurred, and we dis... | [
"Purge",
"all",
"events",
"that",
"have",
"occurred",
"after",
"the",
"given",
"event",
".",
"step",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L675-L716 | [
"def",
"_Purge",
"(",
"self",
",",
"event",
",",
"by_tags",
")",
":",
"## Keep data in reservoirs that has a step less than event.step",
"_NotExpired",
"=",
"lambda",
"x",
":",
"x",
".",
"step",
"<",
"event",
".",
"step",
"if",
"by_tags",
":",
"def",
"_ExpiredPe... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | RawEventFileLoader.Load | Loads all new events from disk as raw serialized proto bytestrings.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All event proto bytestrings in the file that have not been yielded yet. | tensorboard/backend/event_processing/event_file_loader.py | def Load(self):
"""Loads all new events from disk as raw serialized proto bytestrings.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All event proto bytestrings in the file that have not been yielded yet.
"""
logger.... | def Load(self):
"""Loads all new events from disk as raw serialized proto bytestrings.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All event proto bytestrings in the file that have not been yielded yet.
"""
logger.... | [
"Loads",
"all",
"new",
"events",
"from",
"disk",
"as",
"raw",
"serialized",
"proto",
"bytestrings",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_file_loader.py#L49-L79 | [
"def",
"Load",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Loading events from %s'",
",",
"self",
".",
"_file_path",
")",
"# GetNext() expects a status argument on TF <= 1.7.",
"get_next_args",
"=",
"inspect",
".",
"getargspec",
"(",
"self",
".",
"_reader"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventFileLoader.Load | Loads all new events from disk.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All events in the file that have not been yielded yet. | tensorboard/backend/event_processing/event_file_loader.py | def Load(self):
"""Loads all new events from disk.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All events in the file that have not been yielded yet.
"""
for record in super(EventFileLoader, self).Load():
yie... | def Load(self):
"""Loads all new events from disk.
Calling Load multiple times in a row will not 'drop' events as long as the
return value is not iterated over.
Yields:
All events in the file that have not been yielded yet.
"""
for record in super(EventFileLoader, self).Load():
yie... | [
"Loads",
"all",
"new",
"events",
"from",
"disk",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_file_loader.py#L85-L95 | [
"def",
"Load",
"(",
"self",
")",
":",
"for",
"record",
"in",
"super",
"(",
"EventFileLoader",
",",
"self",
")",
".",
"Load",
"(",
")",
":",
"yield",
"event_pb2",
".",
"Event",
".",
"FromString",
"(",
"record",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | scale_sections | input: unscaled sections.
returns: sections scaled to [0, 255] | tensorboard/plugins/beholder/im_util.py | def scale_sections(sections, scaling_scope):
'''
input: unscaled sections.
returns: sections scaled to [0, 255]
'''
new_sections = []
if scaling_scope == 'layer':
for section in sections:
new_sections.append(scale_image_for_display(section))
elif scaling_scope == 'network':
global_min, glo... | def scale_sections(sections, scaling_scope):
'''
input: unscaled sections.
returns: sections scaled to [0, 255]
'''
new_sections = []
if scaling_scope == 'layer':
for section in sections:
new_sections.append(scale_image_for_display(section))
elif scaling_scope == 'network':
global_min, glo... | [
"input",
":",
"unscaled",
"sections",
".",
"returns",
":",
"sections",
"scaled",
"to",
"[",
"0",
"255",
"]"
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/im_util.py#L35-L53 | [
"def",
"scale_sections",
"(",
"sections",
",",
"scaling_scope",
")",
":",
"new_sections",
"=",
"[",
"]",
"if",
"scaling_scope",
"==",
"'layer'",
":",
"for",
"section",
"in",
"sections",
":",
"new_sections",
".",
"append",
"(",
"scale_image_for_display",
"(",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DebuggerDataStreamHandler.on_value_event | Records the summary values based on an updated message from the debugger.
Logs an error message if writing the event to disk fails.
Args:
event: The Event proto to be processed. | tensorboard/plugins/debugger/debugger_server_lib.py | def on_value_event(self, event):
"""Records the summary values based on an updated message from the debugger.
Logs an error message if writing the event to disk fails.
Args:
event: The Event proto to be processed.
"""
if not event.summary.value:
logger.warn("The summary of the event la... | def on_value_event(self, event):
"""Records the summary values based on an updated message from the debugger.
Logs an error message if writing the event to disk fails.
Args:
event: The Event proto to be processed.
"""
if not event.summary.value:
logger.warn("The summary of the event la... | [
"Records",
"the",
"summary",
"values",
"based",
"on",
"an",
"updated",
"message",
"from",
"the",
"debugger",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_server_lib.py#L112-L167 | [
"def",
"on_value_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"event",
".",
"summary",
".",
"value",
":",
"logger",
".",
"warn",
"(",
"\"The summary of the event lacks a value.\"",
")",
"return",
"# The node name property is actually a watch key, which is a... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DebuggerDataStreamHandler._parse_session_run_index | Parses the session_run_index value from the event proto.
Args:
event: The event with metadata that contains the session_run_index.
Returns:
The int session_run_index value. Or
constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determined. | tensorboard/plugins/debugger/debugger_server_lib.py | def _parse_session_run_index(self, event):
"""Parses the session_run_index value from the event proto.
Args:
event: The event with metadata that contains the session_run_index.
Returns:
The int session_run_index value. Or
constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determ... | def _parse_session_run_index(self, event):
"""Parses the session_run_index value from the event proto.
Args:
event: The event with metadata that contains the session_run_index.
Returns:
The int session_run_index value. Or
constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determ... | [
"Parses",
"the",
"session_run_index",
"value",
"from",
"the",
"event",
"proto",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_server_lib.py#L169-L194 | [
"def",
"_parse_session_run_index",
"(",
"self",
",",
"event",
")",
":",
"metadata_string",
"=",
"event",
".",
"log_message",
".",
"message",
"try",
":",
"metadata",
"=",
"json",
".",
"loads",
"(",
"metadata_string",
")",
"except",
"ValueError",
"as",
"e",
":... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | compress_histogram_proto | Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by interpolating its
variable number of buckets to represent their cumulative weight at a constant
number of compression points. This significantly reduces the size of the
histogram... | tensorboard/plugins/distribution/compressor.py | def compress_histogram_proto(histo, bps=NORMAL_HISTOGRAM_BPS):
"""Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by interpolating its
variable number of buckets to represent their cumulative weight at a constant
number of compre... | def compress_histogram_proto(histo, bps=NORMAL_HISTOGRAM_BPS):
"""Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by interpolating its
variable number of buckets to represent their cumulative weight at a constant
number of compre... | [
"Creates",
"fixed",
"size",
"histogram",
"by",
"adding",
"compression",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L36-L83 | [
"def",
"compress_histogram_proto",
"(",
"histo",
",",
"bps",
"=",
"NORMAL_HISTOGRAM_BPS",
")",
":",
"# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc",
"if",
"not",
"histo",
".",
"num",
":",
"return",
"[",
"CompressedHistogramValue",
"(",
"b",
",",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | compress_histogram | Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by linearly
interpolating its variable number of buckets to represent their cumulative
weight at a constant number of compression points. This significantly reduces
the size of the ... | tensorboard/plugins/distribution/compressor.py | def compress_histogram(buckets, bps=NORMAL_HISTOGRAM_BPS):
"""Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by linearly
interpolating its variable number of buckets to represent their cumulative
weight at a constant number of c... | def compress_histogram(buckets, bps=NORMAL_HISTOGRAM_BPS):
"""Creates fixed size histogram by adding compression to accumulated state.
This routine transforms a histogram at a particular step by linearly
interpolating its variable number of buckets to represent their cumulative
weight at a constant number of c... | [
"Creates",
"fixed",
"size",
"histogram",
"by",
"adding",
"compression",
"to",
"accumulated",
"state",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L86-L138 | [
"def",
"compress_histogram",
"(",
"buckets",
",",
"bps",
"=",
"NORMAL_HISTOGRAM_BPS",
")",
":",
"# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc",
"buckets",
"=",
"np",
".",
"array",
"(",
"buckets",
")",
"if",
"not",
"buckets",
".",
"size",
":",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _lerp | Affinely map from [x0, x1] onto [y0, y1]. | tensorboard/plugins/distribution/compressor.py | def _lerp(x, x0, x1, y0, y1):
"""Affinely map from [x0, x1] onto [y0, y1]."""
return y0 + (x - x0) * float(y1 - y0) / (x1 - x0) | def _lerp(x, x0, x1, y0, y1):
"""Affinely map from [x0, x1] onto [y0, y1]."""
return y0 + (x - x0) * float(y1 - y0) / (x1 - x0) | [
"Affinely",
"map",
"from",
"[",
"x0",
"x1",
"]",
"onto",
"[",
"y0",
"y1",
"]",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L141-L143 | [
"def",
"_lerp",
"(",
"x",
",",
"x0",
",",
"x1",
",",
"y0",
",",
"y1",
")",
":",
"return",
"y0",
"+",
"(",
"x",
"-",
"x0",
")",
"*",
"float",
"(",
"y1",
"-",
"y0",
")",
"/",
"(",
"x1",
"-",
"x0",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ImagesPlugin.is_active | The images plugin is active iff any run has at least one relevant tag. | tensorboard/plugins/image/images_plugin.py | def is_active(self):
"""The images plugin is active iff any run has at least one relevant tag."""
if self._db_connection_provider:
# The plugin is active if one relevant tag can be found in the database.
db = self._db_connection_provider()
cursor = db.execute(
'''
SELECT 1
... | def is_active(self):
"""The images plugin is active iff any run has at least one relevant tag."""
if self._db_connection_provider:
# The plugin is active if one relevant tag can be found in the database.
db = self._db_connection_provider()
cursor = db.execute(
'''
SELECT 1
... | [
"The",
"images",
"plugin",
"is",
"active",
"iff",
"any",
"run",
"has",
"at",
"least",
"one",
"relevant",
"tag",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L77-L93 | [
"def",
"is_active",
"(",
"self",
")",
":",
"if",
"self",
".",
"_db_connection_provider",
":",
"# The plugin is active if one relevant tag can be found in the database.",
"db",
"=",
"self",
".",
"_db_connection_provider",
"(",
")",
"cursor",
"=",
"db",
".",
"execute",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ImagesPlugin._serve_image_metadata | Given a tag and list of runs, serve a list of metadata for images.
Note that the images themselves are not sent; instead, we respond with URLs
to the images. The frontend should treat these URLs as opaque and should not
try to parse information about them or generate them itself, as the format
may chan... | tensorboard/plugins/image/images_plugin.py | def _serve_image_metadata(self, request):
"""Given a tag and list of runs, serve a list of metadata for images.
Note that the images themselves are not sent; instead, we respond with URLs
to the images. The frontend should treat these URLs as opaque and should not
try to parse information about them or... | def _serve_image_metadata(self, request):
"""Given a tag and list of runs, serve a list of metadata for images.
Note that the images themselves are not sent; instead, we respond with URLs
to the images. The frontend should treat these URLs as opaque and should not
try to parse information about them or... | [
"Given",
"a",
"tag",
"and",
"list",
"of",
"runs",
"serve",
"a",
"list",
"of",
"metadata",
"for",
"images",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L147-L165 | [
"def",
"_serve_image_metadata",
"(",
"self",
",",
"request",
")",
":",
"tag",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'tag'",
")",
"run",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'run'",
")",
"sample",
"=",
"int",
"(",
"request",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ImagesPlugin._image_response_for_run | Builds a JSON-serializable object with information about images.
Args:
run: The name of the run.
tag: The name of the tag the images all belong to.
sample: The zero-indexed sample of the image for which to retrieve
information. For instance, setting `sample` to `2` will fetch
info... | tensorboard/plugins/image/images_plugin.py | def _image_response_for_run(self, run, tag, sample):
"""Builds a JSON-serializable object with information about images.
Args:
run: The name of the run.
tag: The name of the tag the images all belong to.
sample: The zero-indexed sample of the image for which to retrieve
information. F... | def _image_response_for_run(self, run, tag, sample):
"""Builds a JSON-serializable object with information about images.
Args:
run: The name of the run.
tag: The name of the tag the images all belong to.
sample: The zero-indexed sample of the image for which to retrieve
information. F... | [
"Builds",
"a",
"JSON",
"-",
"serializable",
"object",
"with",
"information",
"about",
"images",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L167-L233 | [
"def",
"_image_response_for_run",
"(",
"self",
",",
"run",
",",
"tag",
",",
"sample",
")",
":",
"if",
"self",
".",
"_db_connection_provider",
":",
"db",
"=",
"self",
".",
"_db_connection_provider",
"(",
")",
"cursor",
"=",
"db",
".",
"execute",
"(",
"'''\n... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ImagesPlugin._get_individual_image | Returns the actual image bytes for a given image.
Args:
run: The name of the run the image belongs to.
tag: The name of the tag the images belongs to.
index: The index of the image in the current reservoir.
sample: The zero-indexed sample of the image to retrieve (for example,
setti... | tensorboard/plugins/image/images_plugin.py | def _get_individual_image(self, run, tag, index, sample):
"""
Returns the actual image bytes for a given image.
Args:
run: The name of the run the image belongs to.
tag: The name of the tag the images belongs to.
index: The index of the image in the current reservoir.
sample: The ze... | def _get_individual_image(self, run, tag, index, sample):
"""
Returns the actual image bytes for a given image.
Args:
run: The name of the run the image belongs to.
tag: The name of the tag the images belongs to.
index: The index of the image in the current reservoir.
sample: The ze... | [
"Returns",
"the",
"actual",
"image",
"bytes",
"for",
"a",
"given",
"image",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L266-L318 | [
"def",
"_get_individual_image",
"(",
"self",
",",
"run",
",",
"tag",
",",
"index",
",",
"sample",
")",
":",
"if",
"self",
".",
"_db_connection_provider",
":",
"db",
"=",
"self",
".",
"_db_connection_provider",
"(",
")",
"cursor",
"=",
"db",
".",
"execute",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ImagesPlugin._serve_individual_image | Serves an individual image. | tensorboard/plugins/image/images_plugin.py | def _serve_individual_image(self, request):
"""Serves an individual image."""
run = request.args.get('run')
tag = request.args.get('tag')
index = int(request.args.get('index'))
sample = int(request.args.get('sample', 0))
data = self._get_individual_image(run, tag, index, sample)
image_type =... | def _serve_individual_image(self, request):
"""Serves an individual image."""
run = request.args.get('run')
tag = request.args.get('tag')
index = int(request.args.get('index'))
sample = int(request.args.get('sample', 0))
data = self._get_individual_image(run, tag, index, sample)
image_type =... | [
"Serves",
"an",
"individual",
"image",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L321-L330 | [
"def",
"_serve_individual_image",
"(",
"self",
",",
"request",
")",
":",
"run",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'run'",
")",
"tag",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'tag'",
")",
"index",
"=",
"int",
"(",
"request",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | start_runs | Generate a PR curve with precision and recall evenly weighted.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
run_name: The name of the run.
thresholds: The number of thresholds to use for PR curves.
mask_every_other_prediction: Whe... | tensorboard/plugins/pr_curve/pr_curve_demo.py | def start_runs(
logdir,
steps,
run_name,
thresholds,
mask_every_other_prediction=False):
"""Generate a PR curve with precision and recall evenly weighted.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
run_name: The na... | def start_runs(
logdir,
steps,
run_name,
thresholds,
mask_every_other_prediction=False):
"""Generate a PR curve with precision and recall evenly weighted.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
run_name: The na... | [
"Generate",
"a",
"PR",
"curve",
"with",
"precision",
"and",
"recall",
"evenly",
"weighted",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curve_demo.py#L51-L195 | [
"def",
"start_runs",
"(",
"logdir",
",",
"steps",
",",
"run_name",
",",
"thresholds",
",",
"mask_every_other_prediction",
"=",
"False",
")",
":",
"tf",
".",
"compat",
".",
"v1",
".",
"reset_default_graph",
"(",
")",
"tf",
".",
"compat",
".",
"v1",
".",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run_all | Generate PR curve summaries.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
verbose: Whether to print the names of runs into stdout during execution.
thresholds: The number of thresholds to use for PR curves. | tensorboard/plugins/pr_curve/pr_curve_demo.py | def run_all(logdir, steps, thresholds, verbose=False):
"""Generate PR curve summaries.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
verbose: Whether to print the names of runs into stdout during execution.
thresholds: The number of ... | def run_all(logdir, steps, thresholds, verbose=False):
"""Generate PR curve summaries.
Arguments:
logdir: The directory into which to store all the runs' data.
steps: The number of steps to run for.
verbose: Whether to print the names of runs into stdout during execution.
thresholds: The number of ... | [
"Generate",
"PR",
"curve",
"summaries",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curve_demo.py#L197-L227 | [
"def",
"run_all",
"(",
"logdir",
",",
"steps",
",",
"thresholds",
",",
"verbose",
"=",
"False",
")",
":",
"# First, we generate data for a PR curve that assigns even weights for",
"# predictions of all classes.",
"run_name",
"=",
"'colors'",
"if",
"verbose",
":",
"print",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | image | Write an image summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active name scopes.
data: A `Tensor` representing pixel data with shape `[k, h, w, c]`,
where `k` is the number of images, `h` and `w` are the height and
... | tensorboard/plugins/image/summary_v2.py | def image(name,
data,
step=None,
max_outputs=3,
description=None):
"""Write an image summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active name scopes.
data: A `Tensor` representing pixe... | def image(name,
data,
step=None,
max_outputs=3,
description=None):
"""Write an image summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active name scopes.
data: A `Tensor` representing pixe... | [
"Write",
"an",
"image",
"summary",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary_v2.py#L29-L88 | [
"def",
"image",
"(",
"name",
",",
"data",
",",
"step",
"=",
"None",
",",
"max_outputs",
"=",
"3",
",",
"description",
"=",
"None",
")",
":",
"summary_metadata",
"=",
"metadata",
".",
"create_summary_metadata",
"(",
"display_name",
"=",
"None",
",",
"descri... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | WitConfigBuilder.set_examples | Sets the examples to be displayed in WIT.
Args:
examples: List of example protos.
Returns:
self, in order to enabled method chaining. | tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py | def set_examples(self, examples):
"""Sets the examples to be displayed in WIT.
Args:
examples: List of example protos.
Returns:
self, in order to enabled method chaining.
"""
self.store('examples', examples)
if len(examples) > 0:
self.store('are_sequence_examples',
... | def set_examples(self, examples):
"""Sets the examples to be displayed in WIT.
Args:
examples: List of example protos.
Returns:
self, in order to enabled method chaining.
"""
self.store('examples', examples)
if len(examples) > 0:
self.store('are_sequence_examples',
... | [
"Sets",
"the",
"examples",
"to",
"be",
"displayed",
"in",
"WIT",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L62-L75 | [
"def",
"set_examples",
"(",
"self",
",",
"examples",
")",
":",
"self",
".",
"store",
"(",
"'examples'",
",",
"examples",
")",
"if",
"len",
"(",
"examples",
")",
">",
"0",
":",
"self",
".",
"store",
"(",
"'are_sequence_examples'",
",",
"isinstance",
"(",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | WitConfigBuilder.set_estimator_and_feature_spec | Sets the model for inference as a TF Estimator.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a TF Estimator object as the model to query. In order to
accomplish this, a feature_spec must also be provided to parse the
example protos for input into the estimator.
... | tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py | def set_estimator_and_feature_spec(self, estimator, feature_spec):
"""Sets the model for inference as a TF Estimator.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a TF Estimator object as the model to query. In order to
accomplish this, a feature_spec must also be ... | def set_estimator_and_feature_spec(self, estimator, feature_spec):
"""Sets the model for inference as a TF Estimator.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a TF Estimator object as the model to query. In order to
accomplish this, a feature_spec must also be ... | [
"Sets",
"the",
"model",
"for",
"inference",
"as",
"a",
"TF",
"Estimator",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L327-L352 | [
"def",
"set_estimator_and_feature_spec",
"(",
"self",
",",
"estimator",
",",
"feature_spec",
")",
":",
"# If custom function is set, remove it before setting estimator",
"self",
".",
"delete",
"(",
"'custom_predict_fn'",
")",
"self",
".",
"store",
"(",
"'estimator_and_spec'... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | WitConfigBuilder.set_compare_estimator_and_feature_spec | Sets a second model for inference as a TF Estimator.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a TF Estimator object as the model to query. In ord... | tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py | def set_compare_estimator_and_feature_spec(self, estimator, feature_spec):
"""Sets a second model for inference as a TF Estimator.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to q... | def set_compare_estimator_and_feature_spec(self, estimator, feature_spec):
"""Sets a second model for inference as a TF Estimator.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to q... | [
"Sets",
"a",
"second",
"model",
"for",
"inference",
"as",
"a",
"TF",
"Estimator",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L354-L382 | [
"def",
"set_compare_estimator_and_feature_spec",
"(",
"self",
",",
"estimator",
",",
"feature_spec",
")",
":",
"# If custom function is set, remove it before setting estimator",
"self",
".",
"delete",
"(",
"'compare_custom_predict_fn'",
")",
"self",
".",
"store",
"(",
"'com... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | WitConfigBuilder.set_custom_predict_fn | Sets a custom function for inference.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a custom function as the model to query. In this case, the
provided function should accept example protos and return:
- For classification: A 2D list of numbers. The first dimensio... | tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py | def set_custom_predict_fn(self, predict_fn):
"""Sets a custom function for inference.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a custom function as the model to query. In this case, the
provided function should accept example protos and return:
- For clas... | def set_custom_predict_fn(self, predict_fn):
"""Sets a custom function for inference.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a custom function as the model to query. In this case, the
provided function should accept example protos and return:
- For clas... | [
"Sets",
"a",
"custom",
"function",
"for",
"inference",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L384-L411 | [
"def",
"set_custom_predict_fn",
"(",
"self",
",",
"predict_fn",
")",
":",
"# If estimator is set, remove it before setting predict_fn",
"self",
".",
"delete",
"(",
"'estimator_and_spec'",
")",
"self",
".",
"store",
"(",
"'custom_predict_fn'",
",",
"predict_fn",
")",
"se... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | WitConfigBuilder.set_compare_custom_predict_fn | Sets a second custom function for inference.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use a custom function as the model to query. In this case, the
... | tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py | def set_compare_custom_predict_fn(self, predict_fn):
"""Sets a second custom function for inference.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use... | def set_compare_custom_predict_fn(self, predict_fn):
"""Sets a second custom function for inference.
If you wish to compare the results of two models in WIT, use this method
to setup the details of the second model.
Instead of using TF Serving to host a model for WIT to query, WIT can
directly use... | [
"Sets",
"a",
"second",
"custom",
"function",
"for",
"inference",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L413-L443 | [
"def",
"set_compare_custom_predict_fn",
"(",
"self",
",",
"predict_fn",
")",
":",
"# If estimator is set, remove it before setting predict_fn",
"self",
".",
"delete",
"(",
"'compare_estimator_and_spec'",
")",
"self",
".",
"store",
"(",
"'compare_custom_predict_fn'",
",",
"p... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Visualizer._reshape_conv_array | Reshape a rank 4 array to be rank 2, where each column of block_width is
a filter, and each row of block height is an input channel. For example:
[[[[ 11, 21, 31, 41],
[ 51, 61, 71, 81],
[ 91, 101, 111, 121]],
[[ 12, 22, 32, 42],
[ 52, 62, 72, 82],
[ 92, 102, 112, ... | tensorboard/plugins/beholder/visualizer.py | def _reshape_conv_array(self, array, section_height, image_width):
'''Reshape a rank 4 array to be rank 2, where each column of block_width is
a filter, and each row of block height is an input channel. For example:
[[[[ 11, 21, 31, 41],
[ 51, 61, 71, 81],
[ 91, 101, 111, 121]],
[... | def _reshape_conv_array(self, array, section_height, image_width):
'''Reshape a rank 4 array to be rank 2, where each column of block_width is
a filter, and each row of block height is an input channel. For example:
[[[[ 11, 21, 31, 41],
[ 51, 61, 71, 81],
[ 91, 101, 111, 121]],
[... | [
"Reshape",
"a",
"rank",
"4",
"array",
"to",
"be",
"rank",
"2",
"where",
"each",
"column",
"of",
"block_width",
"is",
"a",
"filter",
"and",
"each",
"row",
"of",
"block",
"height",
"is",
"an",
"input",
"channel",
".",
"For",
"example",
":"
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L42-L106 | [
"def",
"_reshape_conv_array",
"(",
"self",
",",
"array",
",",
"section_height",
",",
"image_width",
")",
":",
"# E.g. [100, 24, 24, 10]: this shouldn't be reshaped like normal.",
"if",
"array",
".",
"shape",
"[",
"1",
"]",
"==",
"array",
".",
"shape",
"[",
"2",
"]... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Visualizer._reshape_irregular_array | Reshapes arrays of ranks not in {1, 2, 4} | tensorboard/plugins/beholder/visualizer.py | def _reshape_irregular_array(self, array, section_height, image_width):
'''Reshapes arrays of ranks not in {1, 2, 4}
'''
section_area = section_height * image_width
flattened_array = np.ravel(array)
if not self.config['show_all']:
flattened_array = flattened_array[:int(section_area/MIN_SQUARE... | def _reshape_irregular_array(self, array, section_height, image_width):
'''Reshapes arrays of ranks not in {1, 2, 4}
'''
section_area = section_height * image_width
flattened_array = np.ravel(array)
if not self.config['show_all']:
flattened_array = flattened_array[:int(section_area/MIN_SQUARE... | [
"Reshapes",
"arrays",
"of",
"ranks",
"not",
"in",
"{",
"1",
"2",
"4",
"}"
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L109-L133 | [
"def",
"_reshape_irregular_array",
"(",
"self",
",",
"array",
",",
"section_height",
",",
"image_width",
")",
":",
"section_area",
"=",
"section_height",
"*",
"image_width",
"flattened_array",
"=",
"np",
".",
"ravel",
"(",
"array",
")",
"if",
"not",
"self",
".... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Visualizer._arrays_to_sections | input: unprocessed numpy arrays.
returns: columns of the size that they will appear in the image, not scaled
for display. That needs to wait until after variance is computed. | tensorboard/plugins/beholder/visualizer.py | def _arrays_to_sections(self, arrays):
'''
input: unprocessed numpy arrays.
returns: columns of the size that they will appear in the image, not scaled
for display. That needs to wait until after variance is computed.
'''
sections = []
sections_to_resize_later = {}
show_all = se... | def _arrays_to_sections(self, arrays):
'''
input: unprocessed numpy arrays.
returns: columns of the size that they will appear in the image, not scaled
for display. That needs to wait until after variance is computed.
'''
sections = []
sections_to_resize_later = {}
show_all = se... | [
"input",
":",
"unprocessed",
"numpy",
"arrays",
".",
"returns",
":",
"columns",
"of",
"the",
"size",
"that",
"they",
"will",
"appear",
"in",
"the",
"image",
"not",
"scaled",
"for",
"display",
".",
"That",
"needs",
"to",
"wait",
"until",
"after",
"variance"... | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L175-L222 | [
"def",
"_arrays_to_sections",
"(",
"self",
",",
"arrays",
")",
":",
"sections",
"=",
"[",
"]",
"sections_to_resize_later",
"=",
"{",
"}",
"show_all",
"=",
"self",
".",
"config",
"[",
"'show_all'",
"]",
"image_width",
"=",
"self",
".",
"_determine_image_width",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Visualizer._sections_to_variance_sections | Computes the variance of corresponding sections over time.
Returns:
a list of np arrays. | tensorboard/plugins/beholder/visualizer.py | def _sections_to_variance_sections(self, sections_over_time):
'''Computes the variance of corresponding sections over time.
Returns:
a list of np arrays.
'''
variance_sections = []
for i in range(len(sections_over_time[0])):
time_sections = [sections[i] for sections in sections_over_ti... | def _sections_to_variance_sections(self, sections_over_time):
'''Computes the variance of corresponding sections over time.
Returns:
a list of np arrays.
'''
variance_sections = []
for i in range(len(sections_over_time[0])):
time_sections = [sections[i] for sections in sections_over_ti... | [
"Computes",
"the",
"variance",
"of",
"corresponding",
"sections",
"over",
"time",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L225-L238 | [
"def",
"_sections_to_variance_sections",
"(",
"self",
",",
"sections_over_time",
")",
":",
"variance_sections",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"sections_over_time",
"[",
"0",
"]",
")",
")",
":",
"time_sections",
"=",
"[",
"section... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Visualizer._maybe_clear_deque | Clears the deque if certain parts of the config have changed. | tensorboard/plugins/beholder/visualizer.py | def _maybe_clear_deque(self):
'''Clears the deque if certain parts of the config have changed.'''
for config_item in ['values', 'mode', 'show_all']:
if self.config[config_item] != self.old_config[config_item]:
self.sections_over_time.clear()
break
self.old_config = self.config
w... | def _maybe_clear_deque(self):
'''Clears the deque if certain parts of the config have changed.'''
for config_item in ['values', 'mode', 'show_all']:
if self.config[config_item] != self.old_config[config_item]:
self.sections_over_time.clear()
break
self.old_config = self.config
w... | [
"Clears",
"the",
"deque",
"if",
"certain",
"parts",
"of",
"the",
"config",
"have",
"changed",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L256-L268 | [
"def",
"_maybe_clear_deque",
"(",
"self",
")",
":",
"for",
"config_item",
"in",
"[",
"'values'",
",",
"'mode'",
",",
"'show_all'",
"]",
":",
"if",
"self",
".",
"config",
"[",
"config_item",
"]",
"!=",
"self",
".",
"old_config",
"[",
"config_item",
"]",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | lazy_load | Decorator to define a function that lazily loads the module 'name'.
This can be used to defer importing troublesome dependencies - e.g. ones that
are large and infrequently used, or that cause a dependency cycle -
until they are actually used.
Args:
name: the fully-qualified name of the module; typically ... | tensorboard/lazy.py | def lazy_load(name):
"""Decorator to define a function that lazily loads the module 'name'.
This can be used to defer importing troublesome dependencies - e.g. ones that
are large and infrequently used, or that cause a dependency cycle -
until they are actually used.
Args:
name: the fully-qualified name... | def lazy_load(name):
"""Decorator to define a function that lazily loads the module 'name'.
This can be used to defer importing troublesome dependencies - e.g. ones that
are large and infrequently used, or that cause a dependency cycle -
until they are actually used.
Args:
name: the fully-qualified name... | [
"Decorator",
"to",
"define",
"a",
"function",
"that",
"lazily",
"loads",
"the",
"module",
"name",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/lazy.py#L27-L76 | [
"def",
"lazy_load",
"(",
"name",
")",
":",
"def",
"wrapper",
"(",
"load_fn",
")",
":",
"# Wrap load_fn to call it exactly once and update __dict__ afterwards to",
"# make future lookups efficient (only failed lookups call __getattr__).",
"@",
"_memoize",
"def",
"load_once",
"(",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _memoize | Memoizing decorator for f, which must have exactly 1 hashable argument. | tensorboard/lazy.py | def _memoize(f):
"""Memoizing decorator for f, which must have exactly 1 hashable argument."""
nothing = object() # Unique "no value" sentinel object.
cache = {}
# Use a reentrant lock so that if f references the resulting wrapper we die
# with recursion depth exceeded instead of deadlocking.
lock = thread... | def _memoize(f):
"""Memoizing decorator for f, which must have exactly 1 hashable argument."""
nothing = object() # Unique "no value" sentinel object.
cache = {}
# Use a reentrant lock so that if f references the resulting wrapper we die
# with recursion depth exceeded instead of deadlocking.
lock = thread... | [
"Memoizing",
"decorator",
"for",
"f",
"which",
"must",
"have",
"exactly",
"1",
"hashable",
"argument",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/lazy.py#L79-L93 | [
"def",
"_memoize",
"(",
"f",
")",
":",
"nothing",
"=",
"object",
"(",
")",
"# Unique \"no value\" sentinel object.",
"cache",
"=",
"{",
"}",
"# Use a reentrant lock so that if f references the resulting wrapper we die",
"# with recursion depth exceeded instead of deadlocking.",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | tf | Provide the root module of a TF-like API for use within TensorBoard.
By default this is equivalent to `import tensorflow as tf`, but it can be used
in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF
API implementation if the real one is not available) or with
//tensorboard/compat:no... | tensorboard/compat/__init__.py | def tf():
"""Provide the root module of a TF-like API for use within TensorBoard.
By default this is equivalent to `import tensorflow as tf`, but it can be used
in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF
API implementation if the real one is not available) or with
//tensor... | def tf():
"""Provide the root module of a TF-like API for use within TensorBoard.
By default this is equivalent to `import tensorflow as tf`, but it can be used
in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF
API implementation if the real one is not available) or with
//tensor... | [
"Provide",
"the",
"root",
"module",
"of",
"a",
"TF",
"-",
"like",
"API",
"for",
"use",
"within",
"TensorBoard",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L32-L55 | [
"def",
"tf",
"(",
")",
":",
"try",
":",
"from",
"tensorboard",
".",
"compat",
"import",
"notf",
"# pylint: disable=g-import-not-at-top",
"except",
"ImportError",
":",
"try",
":",
"import",
"tensorflow",
"# pylint: disable=g-import-not-at-top",
"return",
"tensorflow",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | tf2 | Provide the root module of a TF-2.0 API for use within TensorBoard.
Returns:
The root module of a TF-2.0 API, if available.
Raises:
ImportError: if a TF-2.0 API is not available. | tensorboard/compat/__init__.py | def tf2():
"""Provide the root module of a TF-2.0 API for use within TensorBoard.
Returns:
The root module of a TF-2.0 API, if available.
Raises:
ImportError: if a TF-2.0 API is not available.
"""
# Import the `tf` compat API from this file and check if it's already TF 2.0.
if tf.__version__.start... | def tf2():
"""Provide the root module of a TF-2.0 API for use within TensorBoard.
Returns:
The root module of a TF-2.0 API, if available.
Raises:
ImportError: if a TF-2.0 API is not available.
"""
# Import the `tf` compat API from this file and check if it's already TF 2.0.
if tf.__version__.start... | [
"Provide",
"the",
"root",
"module",
"of",
"a",
"TF",
"-",
"2",
".",
"0",
"API",
"for",
"use",
"within",
"TensorBoard",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L59-L74 | [
"def",
"tf2",
"(",
")",
":",
"# Import the `tf` compat API from this file and check if it's already TF 2.0.",
"if",
"tf",
".",
"__version__",
".",
"startswith",
"(",
"'2.'",
")",
":",
"return",
"tf",
"elif",
"hasattr",
"(",
"tf",
",",
"'compat'",
")",
"and",
"hasa... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _pywrap_tensorflow | Provide pywrap_tensorflow access in TensorBoard.
pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow
and needs to be imported using
`from tensorflow.python import pywrap_tensorflow`. Therefore, we provide
a separate accessor function for it here.
NOTE: pywrap_tensorflow is not part of Tens... | tensorboard/compat/__init__.py | def _pywrap_tensorflow():
"""Provide pywrap_tensorflow access in TensorBoard.
pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow
and needs to be imported using
`from tensorflow.python import pywrap_tensorflow`. Therefore, we provide
a separate accessor function for it here.
NOTE: pywrap... | def _pywrap_tensorflow():
"""Provide pywrap_tensorflow access in TensorBoard.
pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow
and needs to be imported using
`from tensorflow.python import pywrap_tensorflow`. Therefore, we provide
a separate accessor function for it here.
NOTE: pywrap... | [
"Provide",
"pywrap_tensorflow",
"access",
"in",
"TensorBoard",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L79-L105 | [
"def",
"_pywrap_tensorflow",
"(",
")",
":",
"try",
":",
"from",
"tensorboard",
".",
"compat",
"import",
"notf",
"# pylint: disable=g-import-not-at-top",
"except",
"ImportError",
":",
"try",
":",
"from",
"tensorflow",
".",
"python",
"import",
"pywrap_tensorflow",
"# ... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | create_experiment_summary | Returns a summary proto buffer holding this experiment. | tensorboard/plugins/hparams/hparams_minimal_demo.py | def create_experiment_summary():
"""Returns a summary proto buffer holding this experiment."""
# Convert TEMPERATURE_LIST to google.protobuf.ListValue
temperature_list = struct_pb2.ListValue()
temperature_list.extend(TEMPERATURE_LIST)
materials = struct_pb2.ListValue()
materials.extend(HEAT_COEFFICIENTS.ke... | def create_experiment_summary():
"""Returns a summary proto buffer holding this experiment."""
# Convert TEMPERATURE_LIST to google.protobuf.ListValue
temperature_list = struct_pb2.ListValue()
temperature_list.extend(TEMPERATURE_LIST)
materials = struct_pb2.ListValue()
materials.extend(HEAT_COEFFICIENTS.ke... | [
"Returns",
"a",
"summary",
"proto",
"buffer",
"holding",
"this",
"experiment",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L95-L132 | [
"def",
"create_experiment_summary",
"(",
")",
":",
"# Convert TEMPERATURE_LIST to google.protobuf.ListValue",
"temperature_list",
"=",
"struct_pb2",
".",
"ListValue",
"(",
")",
"temperature_list",
".",
"extend",
"(",
"TEMPERATURE_LIST",
")",
"materials",
"=",
"struct_pb2",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run | Runs a temperature simulation.
This will simulate an object at temperature `initial_temperature`
sitting at rest in a large room at temperature `ambient_temperature`.
The object has some intrinsic `heat_coefficient`, which indicates
how much thermal conductivity it has: for instance, metals have high
thermal... | tensorboard/plugins/hparams/hparams_minimal_demo.py | def run(logdir, session_id, hparams, group_name):
"""Runs a temperature simulation.
This will simulate an object at temperature `initial_temperature`
sitting at rest in a large room at temperature `ambient_temperature`.
The object has some intrinsic `heat_coefficient`, which indicates
how much thermal conduc... | def run(logdir, session_id, hparams, group_name):
"""Runs a temperature simulation.
This will simulate an object at temperature `initial_temperature`
sitting at rest in a large room at temperature `ambient_temperature`.
The object has some intrinsic `heat_coefficient`, which indicates
how much thermal conduc... | [
"Runs",
"a",
"temperature",
"simulation",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L135-L221 | [
"def",
"run",
"(",
"logdir",
",",
"session_id",
",",
"hparams",
",",
"group_name",
")",
":",
"tf",
".",
"reset_default_graph",
"(",
")",
"tf",
".",
"set_random_seed",
"(",
"0",
")",
"initial_temperature",
"=",
"hparams",
"[",
"'initial_temperature'",
"]",
"a... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run_all | Run simulations on a reasonable set of parameters.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins. | tensorboard/plugins/hparams/hparams_minimal_demo.py | def run_all(logdir, verbose=False):
"""Run simulations on a reasonable set of parameters.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins.
"""
writer = tf.summary.FileWriter(logdir)
writer.add_summary(create_experiment_s... | def run_all(logdir, verbose=False):
"""Run simulations on a reasonable set of parameters.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins.
"""
writer = tf.summary.FileWriter(logdir)
writer.add_summary(create_experiment_s... | [
"Run",
"simulations",
"on",
"a",
"reasonable",
"set",
"of",
"parameters",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L224-L253 | [
"def",
"run_all",
"(",
"logdir",
",",
"verbose",
"=",
"False",
")",
":",
"writer",
"=",
"tf",
".",
"summary",
".",
"FileWriter",
"(",
"logdir",
")",
"writer",
".",
"add_summary",
"(",
"create_experiment_summary",
"(",
")",
")",
"writer",
".",
"close",
"(... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | get_filesystem | Return the registered filesystem for the given file. | tensorboard/compat/tensorflow_stub/io/gfile.py | def get_filesystem(filename):
"""Return the registered filesystem for the given file."""
filename = compat.as_str_any(filename)
prefix = ""
index = filename.find("://")
if index >= 0:
prefix = filename[:index]
fs = _REGISTERED_FILESYSTEMS.get(prefix, None)
if fs is None:
rais... | def get_filesystem(filename):
"""Return the registered filesystem for the given file."""
filename = compat.as_str_any(filename)
prefix = ""
index = filename.find("://")
if index >= 0:
prefix = filename[:index]
fs = _REGISTERED_FILESYSTEMS.get(prefix, None)
if fs is None:
rais... | [
"Return",
"the",
"registered",
"filesystem",
"for",
"the",
"given",
"file",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L61-L71 | [
"def",
"get_filesystem",
"(",
"filename",
")",
":",
"filename",
"=",
"compat",
".",
"as_str_any",
"(",
"filename",
")",
"prefix",
"=",
"\"\"",
"index",
"=",
"filename",
".",
"find",
"(",
"\"://\"",
")",
"if",
"index",
">=",
"0",
":",
"prefix",
"=",
"fi... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | walk | Recursive directory tree generator for directories.
Args:
top: string, a Directory name
topdown: bool, Traverse pre order if True, post order if False.
onerror: optional handler for errors. Should be a function, it will be
called with the error as argument. Rethrowing the error aborts the... | tensorboard/compat/tensorflow_stub/io/gfile.py | def walk(top, topdown=True, onerror=None):
"""Recursive directory tree generator for directories.
Args:
top: string, a Directory name
topdown: bool, Traverse pre order if True, post order if False.
onerror: optional handler for errors. Should be a function, it will be
called with the ... | def walk(top, topdown=True, onerror=None):
"""Recursive directory tree generator for directories.
Args:
top: string, a Directory name
topdown: bool, Traverse pre order if True, post order if False.
onerror: optional handler for errors. Should be a function, it will be
called with the ... | [
"Recursive",
"directory",
"tree",
"generator",
"for",
"directories",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L463-L510 | [
"def",
"walk",
"(",
"top",
",",
"topdown",
"=",
"True",
",",
"onerror",
"=",
"None",
")",
":",
"top",
"=",
"compat",
".",
"as_str_any",
"(",
"top",
")",
"fs",
"=",
"get_filesystem",
"(",
"top",
")",
"try",
":",
"listing",
"=",
"listdir",
"(",
"top"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | LocalFileSystem.read | Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
read all the contents of the file from the offset
offset: in... | tensorboard/compat/tensorflow_stub/io/gfile.py | def read(self, filename, binary_mode=False, size=None, offset=None):
"""Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
... | def read(self, filename, binary_mode=False, size=None, offset=None):
"""Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
... | [
"Reads",
"contents",
"of",
"a",
"file",
"to",
"a",
"string",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L89-L110 | [
"def",
"read",
"(",
"self",
",",
"filename",
",",
"binary_mode",
"=",
"False",
",",
"size",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"mode",
"=",
"\"rb\"",
"if",
"binary_mode",
"else",
"\"r\"",
"with",
"io",
".",
"open",
"(",
"filename",
",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | LocalFileSystem.glob | Returns a list of files that match the given pattern(s). | tensorboard/compat/tensorflow_stub/io/gfile.py | def glob(self, filename):
"""Returns a list of files that match the given pattern(s)."""
if isinstance(filename, six.string_types):
return [
# Convert the filenames to string from bytes.
compat.as_str_any(matching_filename)
for matching_filenam... | def glob(self, filename):
"""Returns a list of files that match the given pattern(s)."""
if isinstance(filename, six.string_types):
return [
# Convert the filenames to string from bytes.
compat.as_str_any(matching_filename)
for matching_filenam... | [
"Returns",
"a",
"list",
"of",
"files",
"that",
"match",
"the",
"given",
"pattern",
"(",
"s",
")",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L112-L128 | [
"def",
"glob",
"(",
"self",
",",
"filename",
")",
":",
"if",
"isinstance",
"(",
"filename",
",",
"six",
".",
"string_types",
")",
":",
"return",
"[",
"# Convert the filenames to string from bytes.",
"compat",
".",
"as_str_any",
"(",
"matching_filename",
")",
"fo... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | LocalFileSystem.listdir | Returns a list of entries contained within a directory. | tensorboard/compat/tensorflow_stub/io/gfile.py | def listdir(self, dirname):
"""Returns a list of entries contained within a directory."""
if not self.isdir(dirname):
raise errors.NotFoundError(None, None, "Could not find directory")
entries = os.listdir(compat.as_str_any(dirname))
entries = [compat.as_str_any(item) for it... | def listdir(self, dirname):
"""Returns a list of entries contained within a directory."""
if not self.isdir(dirname):
raise errors.NotFoundError(None, None, "Could not find directory")
entries = os.listdir(compat.as_str_any(dirname))
entries = [compat.as_str_any(item) for it... | [
"Returns",
"a",
"list",
"of",
"entries",
"contained",
"within",
"a",
"directory",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L134-L141 | [
"def",
"listdir",
"(",
"self",
",",
"dirname",
")",
":",
"if",
"not",
"self",
".",
"isdir",
"(",
"dirname",
")",
":",
"raise",
"errors",
".",
"NotFoundError",
"(",
"None",
",",
"None",
",",
"\"Could not find directory\"",
")",
"entries",
"=",
"os",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | LocalFileSystem.stat | Returns file statistics for a given path. | tensorboard/compat/tensorflow_stub/io/gfile.py | def stat(self, filename):
"""Returns file statistics for a given path."""
# NOTE: Size of the file is given by .st_size as returned from
# os.stat(), but we convert to .length
try:
len = os.stat(compat.as_bytes(filename)).st_size
except OSError:
raise erro... | def stat(self, filename):
"""Returns file statistics for a given path."""
# NOTE: Size of the file is given by .st_size as returned from
# os.stat(), but we convert to .length
try:
len = os.stat(compat.as_bytes(filename)).st_size
except OSError:
raise erro... | [
"Returns",
"file",
"statistics",
"for",
"a",
"given",
"path",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L143-L151 | [
"def",
"stat",
"(",
"self",
",",
"filename",
")",
":",
"# NOTE: Size of the file is given by .st_size as returned from",
"# os.stat(), but we convert to .length",
"try",
":",
"len",
"=",
"os",
".",
"stat",
"(",
"compat",
".",
"as_bytes",
"(",
"filename",
")",
")",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.bucket_and_path | Split an S3-prefixed URL into bucket and path. | tensorboard/compat/tensorflow_stub/io/gfile.py | def bucket_and_path(self, url):
"""Split an S3-prefixed URL into bucket and path."""
url = compat.as_str_any(url)
if url.startswith("s3://"):
url = url[len("s3://"):]
idx = url.index("/")
bucket = url[:idx]
path = url[(idx + 1):]
return bucket, path | def bucket_and_path(self, url):
"""Split an S3-prefixed URL into bucket and path."""
url = compat.as_str_any(url)
if url.startswith("s3://"):
url = url[len("s3://"):]
idx = url.index("/")
bucket = url[:idx]
path = url[(idx + 1):]
return bucket, path | [
"Split",
"an",
"S3",
"-",
"prefixed",
"URL",
"into",
"bucket",
"and",
"path",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L161-L169 | [
"def",
"bucket_and_path",
"(",
"self",
",",
"url",
")",
":",
"url",
"=",
"compat",
".",
"as_str_any",
"(",
"url",
")",
"if",
"url",
".",
"startswith",
"(",
"\"s3://\"",
")",
":",
"url",
"=",
"url",
"[",
"len",
"(",
"\"s3://\"",
")",
":",
"]",
"idx"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.exists | Determines whether a path exists or not. | tensorboard/compat/tensorflow_stub/io/gfile.py | def exists(self, filename):
"""Determines whether a path exists or not."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(filename)
r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
if r.get("Contents") or r.get("CommonPrefixes"):
ret... | def exists(self, filename):
"""Determines whether a path exists or not."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(filename)
r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
if r.get("Contents") or r.get("CommonPrefixes"):
ret... | [
"Determines",
"whether",
"a",
"path",
"exists",
"or",
"not",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L171-L178 | [
"def",
"exists",
"(",
"self",
",",
"filename",
")",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"\"s3\"",
")",
"bucket",
",",
"path",
"=",
"self",
".",
"bucket_and_path",
"(",
"filename",
")",
"r",
"=",
"client",
".",
"list_objects",
"(",
"Bucket"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.read | Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
read all the contents of the file from the offset
offset: in... | tensorboard/compat/tensorflow_stub/io/gfile.py | def read(self, filename, binary_mode=False, size=None, offset=None):
"""Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
... | def read(self, filename, binary_mode=False, size=None, offset=None):
"""Reads contents of a file to a string.
Args:
filename: string, a path
binary_mode: bool, read as binary if True, otherwise text
size: int, number of bytes or characters to read, otherwise
... | [
"Reads",
"contents",
"of",
"a",
"file",
"to",
"a",
"string",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L184-L229 | [
"def",
"read",
"(",
"self",
",",
"filename",
",",
"binary_mode",
"=",
"False",
",",
"size",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"s3",
"=",
"boto3",
".",
"resource",
"(",
"\"s3\"",
")",
"bucket",
",",
"path",
"=",
"self",
".",
"bucket... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.glob | Returns a list of files that match the given pattern(s). | tensorboard/compat/tensorflow_stub/io/gfile.py | def glob(self, filename):
"""Returns a list of files that match the given pattern(s)."""
# Only support prefix with * at the end and no ? in the string
star_i = filename.find('*')
quest_i = filename.find('?')
if quest_i >= 0:
raise NotImplementedError(
... | def glob(self, filename):
"""Returns a list of files that match the given pattern(s)."""
# Only support prefix with * at the end and no ? in the string
star_i = filename.find('*')
quest_i = filename.find('?')
if quest_i >= 0:
raise NotImplementedError(
... | [
"Returns",
"a",
"list",
"of",
"files",
"that",
"match",
"the",
"given",
"pattern",
"(",
"s",
")",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L231-L256 | [
"def",
"glob",
"(",
"self",
",",
"filename",
")",
":",
"# Only support prefix with * at the end and no ? in the string",
"star_i",
"=",
"filename",
".",
"find",
"(",
"'*'",
")",
"quest_i",
"=",
"filename",
".",
"find",
"(",
"'?'",
")",
"if",
"quest_i",
">=",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.isdir | Returns whether the path is a directory or not. | tensorboard/compat/tensorflow_stub/io/gfile.py | def isdir(self, dirname):
"""Returns whether the path is a directory or not."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(dirname)
if not path.endswith("/"):
path += "/" # This will now only retrieve subdir content
r = client.list_objects(Bucket... | def isdir(self, dirname):
"""Returns whether the path is a directory or not."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(dirname)
if not path.endswith("/"):
path += "/" # This will now only retrieve subdir content
r = client.list_objects(Bucket... | [
"Returns",
"whether",
"the",
"path",
"is",
"a",
"directory",
"or",
"not",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L258-L267 | [
"def",
"isdir",
"(",
"self",
",",
"dirname",
")",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"\"s3\"",
")",
"bucket",
",",
"path",
"=",
"self",
".",
"bucket_and_path",
"(",
"dirname",
")",
"if",
"not",
"path",
".",
"endswith",
"(",
"\"/\"",
")"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.listdir | Returns a list of entries contained within a directory. | tensorboard/compat/tensorflow_stub/io/gfile.py | def listdir(self, dirname):
"""Returns a list of entries contained within a directory."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(dirname)
p = client.get_paginator("list_objects")
if not path.endswith("/"):
path += "/" # This will now only ret... | def listdir(self, dirname):
"""Returns a list of entries contained within a directory."""
client = boto3.client("s3")
bucket, path = self.bucket_and_path(dirname)
p = client.get_paginator("list_objects")
if not path.endswith("/"):
path += "/" # This will now only ret... | [
"Returns",
"a",
"list",
"of",
"entries",
"contained",
"within",
"a",
"directory",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L269-L283 | [
"def",
"listdir",
"(",
"self",
",",
"dirname",
")",
":",
"client",
"=",
"boto3",
".",
"client",
"(",
"\"s3\"",
")",
"bucket",
",",
"path",
"=",
"self",
".",
"bucket_and_path",
"(",
"dirname",
")",
"p",
"=",
"client",
".",
"get_paginator",
"(",
"\"list_... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | S3FileSystem.stat | Returns file statistics for a given path. | tensorboard/compat/tensorflow_stub/io/gfile.py | def stat(self, filename):
"""Returns file statistics for a given path."""
# NOTE: Size of the file is given by ContentLength from S3,
# but we convert to .length
client = boto3.client("s3")
bucket, path = self.bucket_and_path(filename)
try:
obj = client.head_o... | def stat(self, filename):
"""Returns file statistics for a given path."""
# NOTE: Size of the file is given by ContentLength from S3,
# but we convert to .length
client = boto3.client("s3")
bucket, path = self.bucket_and_path(filename)
try:
obj = client.head_o... | [
"Returns",
"file",
"statistics",
"for",
"a",
"given",
"path",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L285-L298 | [
"def",
"stat",
"(",
"self",
",",
"filename",
")",
":",
"# NOTE: Size of the file is given by ContentLength from S3,",
"# but we convert to .length",
"client",
"=",
"boto3",
".",
"client",
"(",
"\"s3\"",
")",
"bucket",
",",
"path",
"=",
"self",
".",
"bucket_and_path",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _get_context | Determine the most specific context that we're in.
Returns:
_CONTEXT_COLAB: If in Colab with an IPython notebook context.
_CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook
context (e.g., from running `jupyter notebook` at the command
line).
_CONTEXT_NONE: Otherwise (e.g., b... | tensorboard/notebook.py | def _get_context():
"""Determine the most specific context that we're in.
Returns:
_CONTEXT_COLAB: If in Colab with an IPython notebook context.
_CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook
context (e.g., from running `jupyter notebook` at the command
line).
_CONTEXT... | def _get_context():
"""Determine the most specific context that we're in.
Returns:
_CONTEXT_COLAB: If in Colab with an IPython notebook context.
_CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook
context (e.g., from running `jupyter notebook` at the command
line).
_CONTEXT... | [
"Determine",
"the",
"most",
"specific",
"context",
"that",
"we",
"re",
"in",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L38-L74 | [
"def",
"_get_context",
"(",
")",
":",
"# In Colab, the `google.colab` module is available, but the shell",
"# returned by `IPython.get_ipython` does not have a `get_trait`",
"# method.",
"try",
":",
"import",
"google",
".",
"colab",
"import",
"IPython",
"except",
"ImportError",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | start | Launch and display a TensorBoard instance as if at the command line.
Args:
args_string: Command-line arguments to TensorBoard, to be
interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0".
Shell metacharacters are not supported: e.g., "--logdir 2>&1" will
point the logdir at the literal... | tensorboard/notebook.py | def start(args_string):
"""Launch and display a TensorBoard instance as if at the command line.
Args:
args_string: Command-line arguments to TensorBoard, to be
interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0".
Shell metacharacters are not supported: e.g., "--logdir 2>&1" will
po... | def start(args_string):
"""Launch and display a TensorBoard instance as if at the command line.
Args:
args_string: Command-line arguments to TensorBoard, to be
interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0".
Shell metacharacters are not supported: e.g., "--logdir 2>&1" will
po... | [
"Launch",
"and",
"display",
"a",
"TensorBoard",
"instance",
"as",
"if",
"at",
"the",
"command",
"line",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L118-L207 | [
"def",
"start",
"(",
"args_string",
")",
":",
"context",
"=",
"_get_context",
"(",
")",
"try",
":",
"import",
"IPython",
"import",
"IPython",
".",
"display",
"except",
"ImportError",
":",
"IPython",
"=",
"None",
"if",
"context",
"==",
"_CONTEXT_NONE",
":",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _time_delta_from_info | Format the elapsed time for the given TensorBoardInfo.
Args:
info: A TensorBoardInfo value.
Returns:
A human-readable string describing the time since the server
described by `info` started: e.g., "2 days, 0:48:58". | tensorboard/notebook.py | def _time_delta_from_info(info):
"""Format the elapsed time for the given TensorBoardInfo.
Args:
info: A TensorBoardInfo value.
Returns:
A human-readable string describing the time since the server
described by `info` started: e.g., "2 days, 0:48:58".
"""
delta_seconds = int(time.time()) - info.... | def _time_delta_from_info(info):
"""Format the elapsed time for the given TensorBoardInfo.
Args:
info: A TensorBoardInfo value.
Returns:
A human-readable string describing the time since the server
described by `info` started: e.g., "2 days, 0:48:58".
"""
delta_seconds = int(time.time()) - info.... | [
"Format",
"the",
"elapsed",
"time",
"for",
"the",
"given",
"TensorBoardInfo",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L210-L221 | [
"def",
"_time_delta_from_info",
"(",
"info",
")",
":",
"delta_seconds",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"-",
"info",
".",
"start_time",
"return",
"str",
"(",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"delta_seconds",
")",
")... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | display | Display a TensorBoard instance already running on this machine.
Args:
port: The port on which the TensorBoard server is listening, as an
`int`, or `None` to automatically select the most recently
launched TensorBoard.
height: The height of the frame into which to render the TensorBoard
UI, ... | tensorboard/notebook.py | def display(port=None, height=None):
"""Display a TensorBoard instance already running on this machine.
Args:
port: The port on which the TensorBoard server is listening, as an
`int`, or `None` to automatically select the most recently
launched TensorBoard.
height: The height of the frame into ... | def display(port=None, height=None):
"""Display a TensorBoard instance already running on this machine.
Args:
port: The port on which the TensorBoard server is listening, as an
`int`, or `None` to automatically select the most recently
launched TensorBoard.
height: The height of the frame into ... | [
"Display",
"a",
"TensorBoard",
"instance",
"already",
"running",
"on",
"this",
"machine",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L224-L235 | [
"def",
"display",
"(",
"port",
"=",
"None",
",",
"height",
"=",
"None",
")",
":",
"_display",
"(",
"port",
"=",
"port",
",",
"height",
"=",
"height",
",",
"print_message",
"=",
"True",
",",
"display_handle",
"=",
"None",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _display | Internal version of `display`.
Args:
port: As with `display`.
height: As with `display`.
print_message: True to print which TensorBoard instance was selected
for display (if applicable), or False otherwise.
display_handle: If not None, an IPython display handle into which to
render Tensor... | tensorboard/notebook.py | def _display(port=None, height=None, print_message=False, display_handle=None):
"""Internal version of `display`.
Args:
port: As with `display`.
height: As with `display`.
print_message: True to print which TensorBoard instance was selected
for display (if applicable), or False otherwise.
dis... | def _display(port=None, height=None, print_message=False, display_handle=None):
"""Internal version of `display`.
Args:
port: As with `display`.
height: As with `display`.
print_message: True to print which TensorBoard instance was selected
for display (if applicable), or False otherwise.
dis... | [
"Internal",
"version",
"of",
"display",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L238-L289 | [
"def",
"_display",
"(",
"port",
"=",
"None",
",",
"height",
"=",
"None",
",",
"print_message",
"=",
"False",
",",
"display_handle",
"=",
"None",
")",
":",
"if",
"height",
"is",
"None",
":",
"height",
"=",
"800",
"if",
"port",
"is",
"None",
":",
"info... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _display_colab | Display a TensorBoard instance in a Colab output frame.
The Colab VM is not directly exposed to the network, so the Colab
runtime provides a service worker tunnel to proxy requests from the
end user's browser through to servers running on the Colab VM: the
output frame may issue requests to https://localhost:<... | tensorboard/notebook.py | def _display_colab(port, height, display_handle):
"""Display a TensorBoard instance in a Colab output frame.
The Colab VM is not directly exposed to the network, so the Colab
runtime provides a service worker tunnel to proxy requests from the
end user's browser through to servers running on the Colab VM: the
... | def _display_colab(port, height, display_handle):
"""Display a TensorBoard instance in a Colab output frame.
The Colab VM is not directly exposed to the network, so the Colab
runtime provides a service worker tunnel to proxy requests from the
end user's browser through to servers running on the Colab VM: the
... | [
"Display",
"a",
"TensorBoard",
"instance",
"in",
"a",
"Colab",
"output",
"frame",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L292-L369 | [
"def",
"_display_colab",
"(",
"port",
",",
"height",
",",
"display_handle",
")",
":",
"import",
"IPython",
".",
"display",
"shell",
"=",
"\"\"\"\n <div id=\"root\"></div>\n <script>\n (function() {\n window.TENSORBOARD_ENV = window.TENSORBOARD_ENV || {};\n wi... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | list | Print a listing of known running TensorBoard instances.
TensorBoard instances that were killed uncleanly (e.g., with SIGKILL
or SIGQUIT) may appear in this list even if they are no longer
running. Conversely, this list may be missing some entries if your
operating system's temporary directory has been cleared ... | tensorboard/notebook.py | def list():
"""Print a listing of known running TensorBoard instances.
TensorBoard instances that were killed uncleanly (e.g., with SIGKILL
or SIGQUIT) may appear in this list even if they are no longer
running. Conversely, this list may be missing some entries if your
operating system's temporary directory ... | def list():
"""Print a listing of known running TensorBoard instances.
TensorBoard instances that were killed uncleanly (e.g., with SIGKILL
or SIGQUIT) may appear in this list even if they are no longer
running. Conversely, this list may be missing some entries if your
operating system's temporary directory ... | [
"Print",
"a",
"listing",
"of",
"known",
"running",
"TensorBoard",
"instances",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L392-L414 | [
"def",
"list",
"(",
")",
":",
"infos",
"=",
"manager",
".",
"get_all",
"(",
")",
"if",
"not",
"infos",
":",
"print",
"(",
"\"No known TensorBoard instances running.\"",
")",
"return",
"print",
"(",
"\"Known TensorBoard instances:\"",
")",
"for",
"info",
"in",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | IsTensorFlowEventsFile | Check the path name to see if it is probably a TF Events file.
Args:
path: A file path to check if it is an event file.
Raises:
ValueError: If the path is an empty string.
Returns:
If path is formatted like a TensorFlowEventsFile. | tensorboard/backend/event_processing/io_wrapper.py | def IsTensorFlowEventsFile(path):
"""Check the path name to see if it is probably a TF Events file.
Args:
path: A file path to check if it is an event file.
Raises:
ValueError: If the path is an empty string.
Returns:
If path is formatted like a TensorFlowEventsFile.
"""
if not path:
rais... | def IsTensorFlowEventsFile(path):
"""Check the path name to see if it is probably a TF Events file.
Args:
path: A file path to check if it is an event file.
Raises:
ValueError: If the path is an empty string.
Returns:
If path is formatted like a TensorFlowEventsFile.
"""
if not path:
rais... | [
"Check",
"the",
"path",
"name",
"to",
"see",
"if",
"it",
"is",
"probably",
"a",
"TF",
"Events",
"file",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L45-L59 | [
"def",
"IsTensorFlowEventsFile",
"(",
"path",
")",
":",
"if",
"not",
"path",
":",
"raise",
"ValueError",
"(",
"'Path must be a nonempty string'",
")",
"return",
"'tfevents'",
"in",
"tf",
".",
"compat",
".",
"as_str_any",
"(",
"os",
".",
"path",
".",
"basename"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ListDirectoryAbsolute | Yields all files in the given directory. The paths are absolute. | tensorboard/backend/event_processing/io_wrapper.py | def ListDirectoryAbsolute(directory):
"""Yields all files in the given directory. The paths are absolute."""
return (os.path.join(directory, path)
for path in tf.io.gfile.listdir(directory)) | def ListDirectoryAbsolute(directory):
"""Yields all files in the given directory. The paths are absolute."""
return (os.path.join(directory, path)
for path in tf.io.gfile.listdir(directory)) | [
"Yields",
"all",
"files",
"in",
"the",
"given",
"directory",
".",
"The",
"paths",
"are",
"absolute",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L62-L65 | [
"def",
"ListDirectoryAbsolute",
"(",
"directory",
")",
":",
"return",
"(",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"path",
")",
"for",
"path",
"in",
"tf",
".",
"io",
".",
"gfile",
".",
"listdir",
"(",
"directory",
")",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _EscapeGlobCharacters | Escapes the glob characters in a path.
Python 3 has a glob.escape method, but python 2 lacks it, so we manually
implement this method.
Args:
path: The absolute path to escape.
Returns:
The escaped path string. | tensorboard/backend/event_processing/io_wrapper.py | def _EscapeGlobCharacters(path):
"""Escapes the glob characters in a path.
Python 3 has a glob.escape method, but python 2 lacks it, so we manually
implement this method.
Args:
path: The absolute path to escape.
Returns:
The escaped path string.
"""
drive, path = os.path.splitdrive(path)
retu... | def _EscapeGlobCharacters(path):
"""Escapes the glob characters in a path.
Python 3 has a glob.escape method, but python 2 lacks it, so we manually
implement this method.
Args:
path: The absolute path to escape.
Returns:
The escaped path string.
"""
drive, path = os.path.splitdrive(path)
retu... | [
"Escapes",
"the",
"glob",
"characters",
"in",
"a",
"path",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L68-L81 | [
"def",
"_EscapeGlobCharacters",
"(",
"path",
")",
":",
"drive",
",",
"path",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"path",
")",
"return",
"'%s%s'",
"%",
"(",
"drive",
",",
"_ESCAPE_GLOB_CHARACTERS_REGEX",
".",
"sub",
"(",
"r'[\\1]'",
",",
"path",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ListRecursivelyViaGlobbing | Recursively lists all files within the directory.
This method does not list subdirectories (in addition to regular files), and
the file paths are all absolute. If the directory does not exist, this yields
nothing.
This method does so by glob-ing deeper and deeper directories, ie
foo/*, foo/*/*, foo/*/*/* an... | tensorboard/backend/event_processing/io_wrapper.py | def ListRecursivelyViaGlobbing(top):
"""Recursively lists all files within the directory.
This method does not list subdirectories (in addition to regular files), and
the file paths are all absolute. If the directory does not exist, this yields
nothing.
This method does so by glob-ing deeper and deeper dire... | def ListRecursivelyViaGlobbing(top):
"""Recursively lists all files within the directory.
This method does not list subdirectories (in addition to regular files), and
the file paths are all absolute. If the directory does not exist, this yields
nothing.
This method does so by glob-ing deeper and deeper dire... | [
"Recursively",
"lists",
"all",
"files",
"within",
"the",
"directory",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L84-L137 | [
"def",
"ListRecursivelyViaGlobbing",
"(",
"top",
")",
":",
"current_glob_string",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_EscapeGlobCharacters",
"(",
"top",
")",
",",
"'*'",
")",
"level",
"=",
"0",
"while",
"True",
":",
"logger",
".",
"info",
"(",
"'... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | ListRecursivelyViaWalking | Walks a directory tree, yielding (dir_path, file_paths) tuples.
For each of `top` and its subdirectories, yields a tuple containing the path
to the directory and the path to each of the contained files. Note that
unlike os.Walk()/tf.io.gfile.walk()/ListRecursivelyViaGlobbing, this does not
list subdirectories... | tensorboard/backend/event_processing/io_wrapper.py | def ListRecursivelyViaWalking(top):
"""Walks a directory tree, yielding (dir_path, file_paths) tuples.
For each of `top` and its subdirectories, yields a tuple containing the path
to the directory and the path to each of the contained files. Note that
unlike os.Walk()/tf.io.gfile.walk()/ListRecursivelyViaGlob... | def ListRecursivelyViaWalking(top):
"""Walks a directory tree, yielding (dir_path, file_paths) tuples.
For each of `top` and its subdirectories, yields a tuple containing the path
to the directory and the path to each of the contained files. Note that
unlike os.Walk()/tf.io.gfile.walk()/ListRecursivelyViaGlob... | [
"Walks",
"a",
"directory",
"tree",
"yielding",
"(",
"dir_path",
"file_paths",
")",
"tuples",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L140-L159 | [
"def",
"ListRecursivelyViaWalking",
"(",
"top",
")",
":",
"for",
"dir_path",
",",
"_",
",",
"filenames",
"in",
"tf",
".",
"io",
".",
"gfile",
".",
"walk",
"(",
"top",
",",
"topdown",
"=",
"True",
")",
":",
"yield",
"(",
"dir_path",
",",
"(",
"os",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | GetLogdirSubdirectories | Obtains all subdirectories with events files.
The order of the subdirectories returned is unspecified. The internal logic
that determines order varies by scenario.
Args:
path: The path to a directory under which to find subdirectories.
Returns:
A tuple of absolute paths of all subdirectories each wit... | tensorboard/backend/event_processing/io_wrapper.py | def GetLogdirSubdirectories(path):
"""Obtains all subdirectories with events files.
The order of the subdirectories returned is unspecified. The internal logic
that determines order varies by scenario.
Args:
path: The path to a directory under which to find subdirectories.
Returns:
A tuple of absol... | def GetLogdirSubdirectories(path):
"""Obtains all subdirectories with events files.
The order of the subdirectories returned is unspecified. The internal logic
that determines order varies by scenario.
Args:
path: The path to a directory under which to find subdirectories.
Returns:
A tuple of absol... | [
"Obtains",
"all",
"subdirectories",
"with",
"events",
"files",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L162-L203 | [
"def",
"GetLogdirSubdirectories",
"(",
"path",
")",
":",
"if",
"not",
"tf",
".",
"io",
".",
"gfile",
".",
"exists",
"(",
"path",
")",
":",
"# No directory to traverse.",
"return",
"(",
")",
"if",
"not",
"tf",
".",
"io",
".",
"gfile",
".",
"isdir",
"(",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | audio | Write an audio summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active name scopes.
data: A `Tensor` representing audio data with shape `[k, t, c]`,
where `k` is the number of audio clips, `t` is the number of
frames, ... | tensorboard/plugins/audio/summary_v2.py | def audio(name,
data,
sample_rate,
step=None,
max_outputs=3,
encoding=None,
description=None):
"""Write an audio summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active nam... | def audio(name,
data,
sample_rate,
step=None,
max_outputs=3,
encoding=None,
description=None):
"""Write an audio summary.
Arguments:
name: A name for this summary. The summary tag used for TensorBoard will
be this name prefixed by any active nam... | [
"Write",
"an",
"audio",
"summary",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/summary_v2.py#L34-L109 | [
"def",
"audio",
"(",
"name",
",",
"data",
",",
"sample_rate",
",",
"step",
"=",
"None",
",",
"max_outputs",
"=",
"3",
",",
"encoding",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"audio_ops",
"=",
"getattr",
"(",
"tf",
",",
"'audio'",
","... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | extract_numerics_alert | Determines whether a health pill event contains bad values.
A bad value is one of NaN, -Inf, or +Inf.
Args:
event: (`Event`) A `tensorflow.Event` proto from `DebugNumericSummary`
ops.
Returns:
An instance of `NumericsAlert`, if bad values are found.
`None`, if no bad values are found.
Rais... | tensorboard/plugins/debugger/numerics_alert.py | def extract_numerics_alert(event):
"""Determines whether a health pill event contains bad values.
A bad value is one of NaN, -Inf, or +Inf.
Args:
event: (`Event`) A `tensorflow.Event` proto from `DebugNumericSummary`
ops.
Returns:
An instance of `NumericsAlert`, if bad values are found.
`No... | def extract_numerics_alert(event):
"""Determines whether a health pill event contains bad values.
A bad value is one of NaN, -Inf, or +Inf.
Args:
event: (`Event`) A `tensorflow.Event` proto from `DebugNumericSummary`
ops.
Returns:
An instance of `NumericsAlert`, if bad values are found.
`No... | [
"Determines",
"whether",
"a",
"health",
"pill",
"event",
"contains",
"bad",
"values",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L291-L342 | [
"def",
"extract_numerics_alert",
"(",
"event",
")",
":",
"value",
"=",
"event",
".",
"summary",
".",
"value",
"[",
"0",
"]",
"debugger_plugin_metadata_content",
"=",
"None",
"if",
"value",
".",
"HasField",
"(",
"\"metadata\"",
")",
":",
"plugin_data",
"=",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertHistory.first_timestamp | Obtain the first timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY).
If None, includes all event type keys.
Returns:
First (earliest) timestamp of all the events of the given type (or all
event types if event_key is None). | tensorboard/plugins/debugger/numerics_alert.py | def first_timestamp(self, event_key=None):
"""Obtain the first timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY).
If None, includes all event type keys.
Returns:
First (earliest) timestamp of all the events of the given type (or all
event typ... | def first_timestamp(self, event_key=None):
"""Obtain the first timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY).
If None, includes all event type keys.
Returns:
First (earliest) timestamp of all the events of the given type (or all
event typ... | [
"Obtain",
"the",
"first",
"timestamp",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L136-L152 | [
"def",
"first_timestamp",
"(",
"self",
",",
"event_key",
"=",
"None",
")",
":",
"if",
"event_key",
"is",
"None",
":",
"timestamps",
"=",
"[",
"self",
".",
"_trackers",
"[",
"key",
"]",
".",
"first_timestamp",
"for",
"key",
"in",
"self",
".",
"_trackers",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertHistory.last_timestamp | Obtain the last timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY). If
None, includes all event type keys.
Returns:
Last (latest) timestamp of all the events of the given type (or all
event types if event_key is None). | tensorboard/plugins/debugger/numerics_alert.py | def last_timestamp(self, event_key=None):
"""Obtain the last timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY). If
None, includes all event type keys.
Returns:
Last (latest) timestamp of all the events of the given type (or all
event types if... | def last_timestamp(self, event_key=None):
"""Obtain the last timestamp.
Args:
event_key: the type key of the sought events (e.g., constants.NAN_KEY). If
None, includes all event type keys.
Returns:
Last (latest) timestamp of all the events of the given type (or all
event types if... | [
"Obtain",
"the",
"last",
"timestamp",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L154-L170 | [
"def",
"last_timestamp",
"(",
"self",
",",
"event_key",
"=",
"None",
")",
":",
"if",
"event_key",
"is",
"None",
":",
"timestamps",
"=",
"[",
"self",
".",
"_trackers",
"[",
"key",
"]",
".",
"first_timestamp",
"for",
"key",
"in",
"self",
".",
"_trackers",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertHistory.create_jsonable_history | Creates a JSON-able representation of this object.
Returns:
A dictionary mapping key to EventTrackerDescription (which can be used to
create event trackers). | tensorboard/plugins/debugger/numerics_alert.py | def create_jsonable_history(self):
"""Creates a JSON-able representation of this object.
Returns:
A dictionary mapping key to EventTrackerDescription (which can be used to
create event trackers).
"""
return {value_category_key: tracker.get_description()
for (value_category_key, ... | def create_jsonable_history(self):
"""Creates a JSON-able representation of this object.
Returns:
A dictionary mapping key to EventTrackerDescription (which can be used to
create event trackers).
"""
return {value_category_key: tracker.get_description()
for (value_category_key, ... | [
"Creates",
"a",
"JSON",
"-",
"able",
"representation",
"of",
"this",
"object",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L185-L193 | [
"def",
"create_jsonable_history",
"(",
"self",
")",
":",
"return",
"{",
"value_category_key",
":",
"tracker",
".",
"get_description",
"(",
")",
"for",
"(",
"value_category_key",
",",
"tracker",
")",
"in",
"self",
".",
"_trackers",
".",
"items",
"(",
")",
"}"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertRegistry.register | Register an alerting numeric event.
Args:
numerics_alert: An instance of `NumericsAlert`. | tensorboard/plugins/debugger/numerics_alert.py | def register(self, numerics_alert):
"""Register an alerting numeric event.
Args:
numerics_alert: An instance of `NumericsAlert`.
"""
key = (numerics_alert.device_name, numerics_alert.tensor_name)
if key in self._data:
self._data[key].add(numerics_alert)
else:
if len(self._data... | def register(self, numerics_alert):
"""Register an alerting numeric event.
Args:
numerics_alert: An instance of `NumericsAlert`.
"""
key = (numerics_alert.device_name, numerics_alert.tensor_name)
if key in self._data:
self._data[key].add(numerics_alert)
else:
if len(self._data... | [
"Register",
"an",
"alerting",
"numeric",
"event",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L224-L237 | [
"def",
"register",
"(",
"self",
",",
"numerics_alert",
")",
":",
"key",
"=",
"(",
"numerics_alert",
".",
"device_name",
",",
"numerics_alert",
".",
"tensor_name",
")",
"if",
"key",
"in",
"self",
".",
"_data",
":",
"self",
".",
"_data",
"[",
"key",
"]",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertRegistry.report | Get a report of offending device/tensor names.
The report includes information about the device name, tensor name, first
(earliest) timestamp of the alerting events from the tensor, in addition to
counts of nan, positive inf and negative inf events.
Args:
device_name_filter: regex filter for dev... | tensorboard/plugins/debugger/numerics_alert.py | def report(self, device_name_filter=None, tensor_name_filter=None):
"""Get a report of offending device/tensor names.
The report includes information about the device name, tensor name, first
(earliest) timestamp of the alerting events from the tensor, in addition to
counts of nan, positive inf and neg... | def report(self, device_name_filter=None, tensor_name_filter=None):
"""Get a report of offending device/tensor names.
The report includes information about the device name, tensor name, first
(earliest) timestamp of the alerting events from the tensor, in addition to
counts of nan, positive inf and neg... | [
"Get",
"a",
"report",
"of",
"offending",
"device",
"/",
"tensor",
"names",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L239-L276 | [
"def",
"report",
"(",
"self",
",",
"device_name_filter",
"=",
"None",
",",
"tensor_name_filter",
"=",
"None",
")",
":",
"report",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"_data",
":",
"device_name",
",",
"tensor_name",
"=",
"key",
"history",
"=",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | NumericsAlertRegistry.create_jsonable_registry | Creates a JSON-able representation of this object.
Returns:
A dictionary mapping (device, tensor name) to JSON-able object
representations of NumericsAlertHistory. | tensorboard/plugins/debugger/numerics_alert.py | def create_jsonable_registry(self):
"""Creates a JSON-able representation of this object.
Returns:
A dictionary mapping (device, tensor name) to JSON-able object
representations of NumericsAlertHistory.
"""
# JSON does not support tuples as keys. Only strings. Therefore, we store
# the ... | def create_jsonable_registry(self):
"""Creates a JSON-able representation of this object.
Returns:
A dictionary mapping (device, tensor name) to JSON-able object
representations of NumericsAlertHistory.
"""
# JSON does not support tuples as keys. Only strings. Therefore, we store
# the ... | [
"Creates",
"a",
"JSON",
"-",
"able",
"representation",
"of",
"this",
"object",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/numerics_alert.py#L278-L288 | [
"def",
"create_jsonable_registry",
"(",
"self",
")",
":",
"# JSON does not support tuples as keys. Only strings. Therefore, we store",
"# the device name, tensor name, and dictionary data within a 3-item list.",
"return",
"[",
"HistoryTriplet",
"(",
"pair",
"[",
"0",
"]",
",",
"pai... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run | Generate wave data of the given form.
The provided function `wave_constructor` should accept a scalar tensor
of type float32, representing the frequency (in Hz) at which to
construct a wave, and return a tensor of shape [1, _samples(), `n`]
representing audio data (for some number of channels `n`).
Waves wi... | tensorboard/plugins/audio/audio_demo.py | def run(logdir, run_name, wave_name, wave_constructor):
"""Generate wave data of the given form.
The provided function `wave_constructor` should accept a scalar tensor
of type float32, representing the frequency (in Hz) at which to
construct a wave, and return a tensor of shape [1, _samples(), `n`]
represent... | def run(logdir, run_name, wave_name, wave_constructor):
"""Generate wave data of the given form.
The provided function `wave_constructor` should accept a scalar tensor
of type float32, representing the frequency (in Hz) at which to
construct a wave, and return a tensor of shape [1, _samples(), `n`]
represent... | [
"Generate",
"wave",
"data",
"of",
"the",
"given",
"form",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L49-L133 | [
"def",
"run",
"(",
"logdir",
",",
"run_name",
",",
"wave_name",
",",
"wave_constructor",
")",
":",
"tf",
".",
"compat",
".",
"v1",
".",
"reset_default_graph",
"(",
")",
"tf",
".",
"compat",
".",
"v1",
".",
"set_random_seed",
"(",
"0",
")",
"# On each ste... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | sine_wave | Emit a sine wave at the given frequency. | tensorboard/plugins/audio/audio_demo.py | def sine_wave(frequency):
"""Emit a sine wave at the given frequency."""
xs = tf.reshape(tf.range(_samples(), dtype=tf.float32), [1, _samples(), 1])
ts = xs / FLAGS.sample_rate
return tf.sin(2 * math.pi * frequency * ts) | def sine_wave(frequency):
"""Emit a sine wave at the given frequency."""
xs = tf.reshape(tf.range(_samples(), dtype=tf.float32), [1, _samples(), 1])
ts = xs / FLAGS.sample_rate
return tf.sin(2 * math.pi * frequency * ts) | [
"Emit",
"a",
"sine",
"wave",
"at",
"the",
"given",
"frequency",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L139-L143 | [
"def",
"sine_wave",
"(",
"frequency",
")",
":",
"xs",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"range",
"(",
"_samples",
"(",
")",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
",",
"[",
"1",
",",
"_samples",
"(",
")",
",",
"1",
"]",
")",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | triangle_wave | Emit a triangle wave at the given frequency. | tensorboard/plugins/audio/audio_demo.py | def triangle_wave(frequency):
"""Emit a triangle wave at the given frequency."""
xs = tf.reshape(tf.range(_samples(), dtype=tf.float32), [1, _samples(), 1])
ts = xs / FLAGS.sample_rate
#
# A triangle wave looks like this:
#
# /\ /\
# / \ / \
# \ / \ /
# \/ ... | def triangle_wave(frequency):
"""Emit a triangle wave at the given frequency."""
xs = tf.reshape(tf.range(_samples(), dtype=tf.float32), [1, _samples(), 1])
ts = xs / FLAGS.sample_rate
#
# A triangle wave looks like this:
#
# /\ /\
# / \ / \
# \ / \ /
# \/ ... | [
"Emit",
"a",
"triangle",
"wave",
"at",
"the",
"given",
"frequency",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L152-L183 | [
"def",
"triangle_wave",
"(",
"frequency",
")",
":",
"xs",
"=",
"tf",
".",
"reshape",
"(",
"tf",
".",
"range",
"(",
"_samples",
"(",
")",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
",",
"[",
"1",
",",
"_samples",
"(",
")",
",",
"1",
"]",
")",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | bisine_wave | Emit two sine waves, in stereo at different octaves. | tensorboard/plugins/audio/audio_demo.py | def bisine_wave(frequency):
"""Emit two sine waves, in stereo at different octaves."""
#
# We can first our existing sine generator to generate two different
# waves.
f_hi = frequency
f_lo = frequency / 2.0
with tf.name_scope('hi'):
sine_hi = sine_wave(f_hi)
with tf.name_scope('lo'):
sine_lo = s... | def bisine_wave(frequency):
"""Emit two sine waves, in stereo at different octaves."""
#
# We can first our existing sine generator to generate two different
# waves.
f_hi = frequency
f_lo = frequency / 2.0
with tf.name_scope('hi'):
sine_hi = sine_wave(f_hi)
with tf.name_scope('lo'):
sine_lo = s... | [
"Emit",
"two",
"sine",
"waves",
"in",
"stereo",
"at",
"different",
"octaves",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L190-L205 | [
"def",
"bisine_wave",
"(",
"frequency",
")",
":",
"#",
"# We can first our existing sine generator to generate two different",
"# waves.",
"f_hi",
"=",
"frequency",
"f_lo",
"=",
"frequency",
"/",
"2.0",
"with",
"tf",
".",
"name_scope",
"(",
"'hi'",
")",
":",
"sine_h... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | bisine_wahwah_wave | Emit two sine waves with balance oscillating left and right. | tensorboard/plugins/audio/audio_demo.py | def bisine_wahwah_wave(frequency):
"""Emit two sine waves with balance oscillating left and right."""
#
# This is clearly intended to build on the bisine wave defined above,
# so we can start by generating that.
waves_a = bisine_wave(frequency)
#
# Then, by reversing axis 2, we swap the stereo channels. B... | def bisine_wahwah_wave(frequency):
"""Emit two sine waves with balance oscillating left and right."""
#
# This is clearly intended to build on the bisine wave defined above,
# so we can start by generating that.
waves_a = bisine_wave(frequency)
#
# Then, by reversing axis 2, we swap the stereo channels. B... | [
"Emit",
"two",
"sine",
"waves",
"with",
"balance",
"oscillating",
"left",
"and",
"right",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L208-L234 | [
"def",
"bisine_wahwah_wave",
"(",
"frequency",
")",
":",
"#",
"# This is clearly intended to build on the bisine wave defined above,",
"# so we can start by generating that.",
"waves_a",
"=",
"bisine_wave",
"(",
"frequency",
")",
"#",
"# Then, by reversing axis 2, we swap the stereo ... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run_all | Generate waves of the shapes defined above.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins | tensorboard/plugins/audio/audio_demo.py | def run_all(logdir, verbose=False):
"""Generate waves of the shapes defined above.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins
"""
waves = [sine_wave, square_wave, triangle_wave,
bisine_wave, bisine_wahwah_w... | def run_all(logdir, verbose=False):
"""Generate waves of the shapes defined above.
Arguments:
logdir: the directory into which to store all the runs' data
verbose: if true, print out each run's name as it begins
"""
waves = [sine_wave, square_wave, triangle_wave,
bisine_wave, bisine_wahwah_w... | [
"Generate",
"waves",
"of",
"the",
"shapes",
"defined",
"above",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_demo.py#L237-L251 | [
"def",
"run_all",
"(",
"logdir",
",",
"verbose",
"=",
"False",
")",
":",
"waves",
"=",
"[",
"sine_wave",
",",
"square_wave",
",",
"triangle_wave",
",",
"bisine_wave",
",",
"bisine_wahwah_wave",
"]",
"for",
"(",
"i",
",",
"wave_constructor",
")",
"in",
"enu... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | prepare_graph_for_ui | Prepares (modifies in-place) the graph to be served to the front-end.
For now, it supports filtering out attributes that are
too large to be shown in the graph UI.
Args:
graph: The GraphDef proto message.
limit_attr_size: Maximum allowed size in bytes, before the attribute
is considered large. D... | tensorboard/backend/process_graph.py | def prepare_graph_for_ui(graph, limit_attr_size=1024,
large_attrs_key='_too_large_attrs'):
"""Prepares (modifies in-place) the graph to be served to the front-end.
For now, it supports filtering out attributes that are
too large to be shown in the graph UI.
Args:
graph: The GraphD... | def prepare_graph_for_ui(graph, limit_attr_size=1024,
large_attrs_key='_too_large_attrs'):
"""Prepares (modifies in-place) the graph to be served to the front-end.
For now, it supports filtering out attributes that are
too large to be shown in the graph UI.
Args:
graph: The GraphD... | [
"Prepares",
"(",
"modifies",
"in",
"-",
"place",
")",
"the",
"graph",
"to",
"be",
"served",
"to",
"the",
"front",
"-",
"end",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/process_graph.py#L25-L68 | [
"def",
"prepare_graph_for_ui",
"(",
"graph",
",",
"limit_attr_size",
"=",
"1024",
",",
"large_attrs_key",
"=",
"'_too_large_attrs'",
")",
":",
"# Check input for validity.",
"if",
"limit_attr_size",
"is",
"not",
"None",
":",
"if",
"large_attrs_key",
"is",
"None",
":... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | GraphsPlugin.info_impl | Returns a dict of all runs and tags and their data availabilities. | tensorboard/plugins/graph/graphs_plugin.py | def info_impl(self):
"""Returns a dict of all runs and tags and their data availabilities."""
result = {}
def add_row_item(run, tag=None):
run_item = result.setdefault(run, {
'run': run,
'tags': {},
# A run-wide GraphDef of ops.
'run_graph': False})
tag_i... | def info_impl(self):
"""Returns a dict of all runs and tags and their data availabilities."""
result = {}
def add_row_item(run, tag=None):
run_item = result.setdefault(run, {
'run': run,
'tags': {},
# A run-wide GraphDef of ops.
'run_graph': False})
tag_i... | [
"Returns",
"a",
"dict",
"of",
"all",
"runs",
"and",
"tags",
"and",
"their",
"data",
"availabilities",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L74-L143 | [
"def",
"info_impl",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"def",
"add_row_item",
"(",
"run",
",",
"tag",
"=",
"None",
")",
":",
"run_item",
"=",
"result",
".",
"setdefault",
"(",
"run",
",",
"{",
"'run'",
":",
"run",
",",
"'tags'",
":",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | GraphsPlugin.graph_impl | Result of the form `(body, mime_type)`, or `None` if no graph exists. | tensorboard/plugins/graph/graphs_plugin.py | def graph_impl(self, run, tag, is_conceptual, limit_attr_size=None, large_attrs_key=None):
"""Result of the form `(body, mime_type)`, or `None` if no graph exists."""
if is_conceptual:
tensor_events = self._multiplexer.Tensors(run, tag)
# Take the first event if there are multiple events written fro... | def graph_impl(self, run, tag, is_conceptual, limit_attr_size=None, large_attrs_key=None):
"""Result of the form `(body, mime_type)`, or `None` if no graph exists."""
if is_conceptual:
tensor_events = self._multiplexer.Tensors(run, tag)
# Take the first event if there are multiple events written fro... | [
"Result",
"of",
"the",
"form",
"(",
"body",
"mime_type",
")",
"or",
"None",
"if",
"no",
"graph",
"exists",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L145-L169 | [
"def",
"graph_impl",
"(",
"self",
",",
"run",
",",
"tag",
",",
"is_conceptual",
",",
"limit_attr_size",
"=",
"None",
",",
"large_attrs_key",
"=",
"None",
")",
":",
"if",
"is_conceptual",
":",
"tensor_events",
"=",
"self",
".",
"_multiplexer",
".",
"Tensors",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | GraphsPlugin.run_metadata_impl | Result of the form `(body, mime_type)`, or `None` if no data exists. | tensorboard/plugins/graph/graphs_plugin.py | def run_metadata_impl(self, run, tag):
"""Result of the form `(body, mime_type)`, or `None` if no data exists."""
try:
run_metadata = self._multiplexer.RunMetadata(run, tag)
except ValueError:
# TODO(stephanwlee): Should include whether FE is fetching for v1 or v2 RunMetadata
# so we can r... | def run_metadata_impl(self, run, tag):
"""Result of the form `(body, mime_type)`, or `None` if no data exists."""
try:
run_metadata = self._multiplexer.RunMetadata(run, tag)
except ValueError:
# TODO(stephanwlee): Should include whether FE is fetching for v1 or v2 RunMetadata
# so we can r... | [
"Result",
"of",
"the",
"form",
"(",
"body",
"mime_type",
")",
"or",
"None",
"if",
"no",
"data",
"exists",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L171-L187 | [
"def",
"run_metadata_impl",
"(",
"self",
",",
"run",
",",
"tag",
")",
":",
"try",
":",
"run_metadata",
"=",
"self",
".",
"_multiplexer",
".",
"RunMetadata",
"(",
"run",
",",
"tag",
")",
"except",
"ValueError",
":",
"# TODO(stephanwlee): Should include whether FE... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | GraphsPlugin.graph_route | Given a single run, return the graph definition in protobuf format. | tensorboard/plugins/graph/graphs_plugin.py | def graph_route(self, request):
"""Given a single run, return the graph definition in protobuf format."""
run = request.args.get('run')
tag = request.args.get('tag', '')
conceptual_arg = request.args.get('conceptual', False)
is_conceptual = True if conceptual_arg == 'true' else False
if run is ... | def graph_route(self, request):
"""Given a single run, return the graph definition in protobuf format."""
run = request.args.get('run')
tag = request.args.get('tag', '')
conceptual_arg = request.args.get('conceptual', False)
is_conceptual = True if conceptual_arg == 'true' else False
if run is ... | [
"Given",
"a",
"single",
"run",
"return",
"the",
"graph",
"definition",
"in",
"protobuf",
"format",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graphs_plugin.py#L195-L227 | [
"def",
"graph_route",
"(",
"self",
",",
"request",
")",
":",
"run",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'run'",
")",
"tag",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'tag'",
",",
"''",
")",
"conceptual_arg",
"=",
"request",
".",
"ar... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.