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 | convert_predict_response | Converts a PredictResponse to ClassificationResponse or RegressionResponse.
Args:
pred: PredictResponse to convert.
serving_bundle: A `ServingBundle` object that contains the information about
the serving request that the response was generated by.
Returns:
A ClassificationResponse or Regression... | tensorboard/plugins/interactive_inference/utils/common_utils.py | def convert_predict_response(pred, serving_bundle):
"""Converts a PredictResponse to ClassificationResponse or RegressionResponse.
Args:
pred: PredictResponse to convert.
serving_bundle: A `ServingBundle` object that contains the information about
the serving request that the response was generated b... | def convert_predict_response(pred, serving_bundle):
"""Converts a PredictResponse to ClassificationResponse or RegressionResponse.
Args:
pred: PredictResponse to convert.
serving_bundle: A `ServingBundle` object that contains the information about
the serving request that the response was generated b... | [
"Converts",
"a",
"PredictResponse",
"to",
"ClassificationResponse",
"or",
"RegressionResponse",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/utils/common_utils.py#L39-L59 | [
"def",
"convert_predict_response",
"(",
"pred",
",",
"serving_bundle",
")",
":",
"output",
"=",
"pred",
".",
"outputs",
"[",
"serving_bundle",
".",
"predict_output_tensor",
"]",
"raw_output",
"=",
"output",
".",
"float_val",
"if",
"serving_bundle",
".",
"model_typ... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | convert_prediction_values | Converts tensor values into ClassificationResponse or RegressionResponse.
Args:
values: For classification, a 2D list of numbers. The first dimension is for
each example being predicted. The second dimension are the probabilities
for each class ID in the prediction. For regression, a 1D list of numbe... | tensorboard/plugins/interactive_inference/utils/common_utils.py | def convert_prediction_values(values, serving_bundle, model_spec=None):
"""Converts tensor values into ClassificationResponse or RegressionResponse.
Args:
values: For classification, a 2D list of numbers. The first dimension is for
each example being predicted. The second dimension are the probabilities
... | def convert_prediction_values(values, serving_bundle, model_spec=None):
"""Converts tensor values into ClassificationResponse or RegressionResponse.
Args:
values: For classification, a 2D list of numbers. The first dimension is for
each example being predicted. The second dimension are the probabilities
... | [
"Converts",
"tensor",
"values",
"into",
"ClassificationResponse",
"or",
"RegressionResponse",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/utils/common_utils.py#L61-L91 | [
"def",
"convert_prediction_values",
"(",
"values",
",",
"serving_bundle",
",",
"model_spec",
"=",
"None",
")",
":",
"if",
"serving_bundle",
".",
"model_type",
"==",
"'classification'",
":",
"response",
"=",
"classification_pb2",
".",
"ClassificationResponse",
"(",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _GetPurgeMessage | Return the string message associated with TensorBoard purges. | tensorboard/backend/event_processing/plugin_event_accumulator.py | def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step,
event_wall_time, num_expired):
"""Return the string message associated with TensorBoard purges."""
return ('Detected out of order event.step likely caused by a TensorFlow '
'restart. Purging {} expired tensor ev... | def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step,
event_wall_time, num_expired):
"""Return the string message associated with TensorBoard purges."""
return ('Detected out of order event.step likely caused by a TensorFlow '
'restart. Purging {} expired tensor ev... | [
"Return",
"the",
"string",
"message",
"associated",
"with",
"TensorBoard",
"purges",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/plugin_event_accumulator.py#L560-L568 | [
"def",
"_GetPurgeMessage",
"(",
"most_recent_step",
",",
"most_recent_wall_time",
",",
"event_step",
",",
"event_wall_time",
",",
"num_expired",
")",
":",
"return",
"(",
"'Detected out of order event.step likely caused by a TensorFlow '",
"'restart. Purging {} expired tensor events... | 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/plugin_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/plugin_event_accumulator.py#L234-L252 | [
"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",
")",
"with",
"self",
".",
"_pl... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator._ProcessEvent | Called whenever an event is loaded. | tensorboard/backend/event_processing/plugin_event_accumulator.py | def _ProcessEvent(self, event):
"""Called whenever an event is loaded."""
if self._first_event_timestamp is None:
self._first_event_timestamp = event.wall_time
if event.HasField('file_version'):
new_file_version = _ParseFileVersion(event.file_version)
if self.file_version and self.file_ve... | def _ProcessEvent(self, event):
"""Called whenever an event is loaded."""
if self._first_event_timestamp is None:
self._first_event_timestamp = event.wall_time
if event.HasField('file_version'):
new_file_version = _ParseFileVersion(event.file_version)
if self.file_version and self.file_ve... | [
"Called",
"whenever",
"an",
"event",
"is",
"loaded",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/plugin_event_accumulator.py#L268-L356 | [
"def",
"_ProcessEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_first_event_timestamp",
"is",
"None",
":",
"self",
".",
"_first_event_timestamp",
"=",
"event",
".",
"wall_time",
"if",
"event",
".",
"HasField",
"(",
"'file_version'",
")",
":... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | EventAccumulator.Tags | Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary. | tensorboard/backend/event_processing/plugin_event_accumulator.py | def Tags(self):
"""Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary.
"""
return {
TENSORS: list(self.tensors_by_tag.keys()),
# Use a heuristic: if the metagraph is available, but
# graph is not, then we assume the metagra... | def Tags(self):
"""Return all tags found in the value stream.
Returns:
A `{tagType: ['list', 'of', 'tags']}` dictionary.
"""
return {
TENSORS: list(self.tensors_by_tag.keys()),
# Use a heuristic: if the metagraph is available, but
# graph is not, then we assume the metagra... | [
"Return",
"all",
"tags",
"found",
"in",
"the",
"value",
"stream",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/plugin_event_accumulator.py#L358-L371 | [
"def",
"Tags",
"(",
"self",
")",
":",
"return",
"{",
"TENSORS",
":",
"list",
"(",
"self",
".",
"tensors_by_tag",
".",
"keys",
"(",
")",
")",
",",
"# Use a heuristic: if the metagraph is available, but",
"# graph is not, then we assume the metagraph contains the graph.",
... | 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/plugin_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/plugin_event_accumulator.py#L439-L466 | [
"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._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/plugin_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/plugin_event_accumulator.py#L488-L499 | [
"def",
"_CheckForOutOfOrderStepAndMaybePurge",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"step",
"<",
"self",
".",
"most_recent_step",
"and",
"event",
".",
"HasField",
"(",
"'summary'",
")",
":",
"self",
".",
"_Purge",
"(",
"event",
",",
"by... | 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/plugin_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/plugin_event_accumulator.py#L517-L557 | [
"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",
"num_expired",
"=",
"0",
"if",
"by_tags"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | BeholderPluginLoader.load | Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A BeholderPlugin instance or None if it couldn't be loaded. | tensorboard/plugins/beholder/beholder_plugin_loader.py | def load(self, context):
"""Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A BeholderPlugin instance or None if it couldn't be loaded.
"""
try:
# pylint: disable=g-import-not-at-top,unused-import
import tensorflow
except ImportError:
... | def load(self, context):
"""Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A BeholderPlugin instance or None if it couldn't be loaded.
"""
try:
# pylint: disable=g-import-not-at-top,unused-import
import tensorflow
except ImportError:
... | [
"Returns",
"the",
"plugin",
"if",
"possible",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder_plugin_loader.py#L30-L46 | [
"def",
"load",
"(",
"self",
",",
"context",
")",
":",
"try",
":",
"# pylint: disable=g-import-not-at-top,unused-import",
"import",
"tensorflow",
"except",
"ImportError",
":",
"return",
"# pylint: disable=g-import-not-at-top",
"from",
"tensorboard",
".",
"plugins",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _walk_layers | Walks the nested keras layer configuration in preorder.
Args:
keras_layer: Keras configuration from model.to_json.
Yields:
A tuple of (name_scope, layer_config).
name_scope: a string representing a scope name, similar to that of tf.name_scope.
layer_config: a dict representing a Keras layer configu... | tensorboard/plugins/graph/keras_util.py | def _walk_layers(keras_layer):
"""Walks the nested keras layer configuration in preorder.
Args:
keras_layer: Keras configuration from model.to_json.
Yields:
A tuple of (name_scope, layer_config).
name_scope: a string representing a scope name, similar to that of tf.name_scope.
layer_config: a dic... | def _walk_layers(keras_layer):
"""Walks the nested keras layer configuration in preorder.
Args:
keras_layer: Keras configuration from model.to_json.
Yields:
A tuple of (name_scope, layer_config).
name_scope: a string representing a scope name, similar to that of tf.name_scope.
layer_config: a dic... | [
"Walks",
"the",
"nested",
"keras",
"layer",
"configuration",
"in",
"preorder",
".",
"Args",
":",
"keras_layer",
":",
"Keras",
"configuration",
"from",
"model",
".",
"to_json",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L48-L65 | [
"def",
"_walk_layers",
"(",
"keras_layer",
")",
":",
"yield",
"(",
"''",
",",
"keras_layer",
")",
"if",
"keras_layer",
".",
"get",
"(",
"'config'",
")",
".",
"get",
"(",
"'layers'",
")",
":",
"name_scope",
"=",
"keras_layer",
".",
"get",
"(",
"'config'",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _update_dicts | Updates input_to_in_layer, model_name_to_output, and prev_node_name
based on the model_layer.
Args:
name_scope: a string representing a scope name, similar to that of tf.name_scope.
model_layer: a dict representing a Keras model configuration.
input_to_in_layer: a dict mapping Keras.layers.Input to inb... | tensorboard/plugins/graph/keras_util.py | def _update_dicts(name_scope,
model_layer,
input_to_in_layer,
model_name_to_output,
prev_node_name):
"""Updates input_to_in_layer, model_name_to_output, and prev_node_name
based on the model_layer.
Args:
name_scope: a string representing... | def _update_dicts(name_scope,
model_layer,
input_to_in_layer,
model_name_to_output,
prev_node_name):
"""Updates input_to_in_layer, model_name_to_output, and prev_node_name
based on the model_layer.
Args:
name_scope: a string representing... | [
"Updates",
"input_to_in_layer",
"model_name_to_output",
"and",
"prev_node_name",
"based",
"on",
"the",
"model_layer",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L114-L177 | [
"def",
"_update_dicts",
"(",
"name_scope",
",",
"model_layer",
",",
"input_to_in_layer",
",",
"model_name_to_output",
",",
"prev_node_name",
")",
":",
"layer_config",
"=",
"model_layer",
".",
"get",
"(",
"'config'",
")",
"if",
"not",
"layer_config",
".",
"get",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | keras_model_to_graph_def | Returns a GraphDef representation of the Keras model in a dict form.
Note that it only supports models that implemented to_json().
Args:
keras_layer: A dict from Keras model.to_json().
Returns:
A GraphDef representation of the layers in the model. | tensorboard/plugins/graph/keras_util.py | def keras_model_to_graph_def(keras_layer):
"""Returns a GraphDef representation of the Keras model in a dict form.
Note that it only supports models that implemented to_json().
Args:
keras_layer: A dict from Keras model.to_json().
Returns:
A GraphDef representation of the layers in the model.
"""
... | def keras_model_to_graph_def(keras_layer):
"""Returns a GraphDef representation of the Keras model in a dict form.
Note that it only supports models that implemented to_json().
Args:
keras_layer: A dict from Keras model.to_json().
Returns:
A GraphDef representation of the layers in the model.
"""
... | [
"Returns",
"a",
"GraphDef",
"representation",
"of",
"the",
"Keras",
"model",
"in",
"a",
"dict",
"form",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L180-L239 | [
"def",
"keras_model_to_graph_def",
"(",
"keras_layer",
")",
":",
"input_to_layer",
"=",
"{",
"}",
"model_name_to_output",
"=",
"{",
"}",
"g",
"=",
"GraphDef",
"(",
")",
"# Sequential model layers do not have a field \"inbound_nodes\" but",
"# instead are defined implicitly vi... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | HParamsPluginLoader.load | Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A HParamsPlugin instance or None if it couldn't be loaded. | tensorboard/plugins/hparams/hparams_plugin_loader.py | def load(self, context):
"""Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A HParamsPlugin instance or None if it couldn't be loaded.
"""
try:
# pylint: disable=g-import-not-at-top,unused-import
import tensorflow
except ImportError:
... | def load(self, context):
"""Returns the plugin, if possible.
Args:
context: The TBContext flags.
Returns:
A HParamsPlugin instance or None if it couldn't be loaded.
"""
try:
# pylint: disable=g-import-not-at-top,unused-import
import tensorflow
except ImportError:
... | [
"Returns",
"the",
"plugin",
"if",
"possible",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_plugin_loader.py#L30-L46 | [
"def",
"load",
"(",
"self",
",",
"context",
")",
":",
"try",
":",
"# pylint: disable=g-import-not-at-top,unused-import",
"import",
"tensorflow",
"except",
"ImportError",
":",
"return",
"# pylint: disable=g-import-not-at-top",
"from",
"tensorboard",
".",
"plugins",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | HParamsPlugin.is_active | Returns True if the hparams plugin is active.
The hparams plugin is active iff there is a tag with
the hparams plugin name as its plugin name and the scalars plugin is
registered and active. | tensorboard/plugins/hparams/hparams_plugin.py | def is_active(self):
"""Returns True if the hparams plugin is active.
The hparams plugin is active iff there is a tag with
the hparams plugin name as its plugin name and the scalars plugin is
registered and active.
"""
if not self._context.multiplexer:
return False
scalars_plugin = se... | def is_active(self):
"""Returns True if the hparams plugin is active.
The hparams plugin is active iff there is a tag with
the hparams plugin name as its plugin name and the scalars plugin is
registered and active.
"""
if not self._context.multiplexer:
return False
scalars_plugin = se... | [
"Returns",
"True",
"if",
"the",
"hparams",
"plugin",
"is",
"active",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_plugin.py#L71-L84 | [
"def",
"is_active",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_context",
".",
"multiplexer",
":",
"return",
"False",
"scalars_plugin",
"=",
"self",
".",
"_get_scalars_plugin",
"(",
")",
"if",
"not",
"scalars_plugin",
"or",
"not",
"scalars_plugin",
".... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | markdown_to_safe_html | Convert Markdown to HTML that's safe to splice into the DOM.
Arguments:
markdown_string: A Unicode string or UTF-8--encoded bytestring
containing Markdown source. Markdown tables are supported.
Returns:
A string containing safe HTML. | tensorboard/plugin_util.py | def markdown_to_safe_html(markdown_string):
"""Convert Markdown to HTML that's safe to splice into the DOM.
Arguments:
markdown_string: A Unicode string or UTF-8--encoded bytestring
containing Markdown source. Markdown tables are supported.
Returns:
A string containing safe HTML.
"""
warning =... | def markdown_to_safe_html(markdown_string):
"""Convert Markdown to HTML that's safe to splice into the DOM.
Arguments:
markdown_string: A Unicode string or UTF-8--encoded bytestring
containing Markdown source. Markdown tables are supported.
Returns:
A string containing safe HTML.
"""
warning =... | [
"Convert",
"Markdown",
"to",
"HTML",
"that",
"s",
"safe",
"to",
"splice",
"into",
"the",
"DOM",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugin_util.py#L61-L87 | [
"def",
"markdown_to_safe_html",
"(",
"markdown_string",
")",
":",
"warning",
"=",
"''",
"# Convert to utf-8 whenever we have a binary input.",
"if",
"isinstance",
"(",
"markdown_string",
",",
"six",
".",
"binary_type",
")",
":",
"markdown_string_decoded",
"=",
"markdown_s... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | as_dtype | Converts the given `type_value` to a `DType`.
Args:
type_value: A value that can be converted to a `tf.DType` object. This may
currently be a `tf.DType` object, a [`DataType`
enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),
a string type name, or a `numpy.... | tensorboard/compat/tensorflow_stub/dtypes.py | def as_dtype(type_value):
"""Converts the given `type_value` to a `DType`.
Args:
type_value: A value that can be converted to a `tf.DType` object. This may
currently be a `tf.DType` object, a [`DataType`
enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),
... | def as_dtype(type_value):
"""Converts the given `type_value` to a `DType`.
Args:
type_value: A value that can be converted to a `tf.DType` object. This may
currently be a `tf.DType` object, a [`DataType`
enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),
... | [
"Converts",
"the",
"given",
"type_value",
"to",
"a",
"DType",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L639-L690 | [
"def",
"as_dtype",
"(",
"type_value",
")",
":",
"if",
"isinstance",
"(",
"type_value",
",",
"DType",
")",
":",
"return",
"type_value",
"try",
":",
"return",
"_INTERN_TABLE",
"[",
"type_value",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
"return",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.real_dtype | Returns the dtype correspond to this dtype's real part. | tensorboard/compat/tensorflow_stub/dtypes.py | def real_dtype(self):
"""Returns the dtype correspond to this dtype's real part."""
base = self.base_dtype
if base == complex64:
return float32
elif base == complex128:
return float64
else:
return self | def real_dtype(self):
"""Returns the dtype correspond to this dtype's real part."""
base = self.base_dtype
if base == complex64:
return float32
elif base == complex128:
return float64
else:
return self | [
"Returns",
"the",
"dtype",
"correspond",
"to",
"this",
"dtype",
"s",
"real",
"part",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L113-L121 | [
"def",
"real_dtype",
"(",
"self",
")",
":",
"base",
"=",
"self",
".",
"base_dtype",
"if",
"base",
"==",
"complex64",
":",
"return",
"float32",
"elif",
"base",
"==",
"complex128",
":",
"return",
"float64",
"else",
":",
"return",
"self"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.is_integer | Returns whether this is a (non-quantized) integer type. | tensorboard/compat/tensorflow_stub/dtypes.py | def is_integer(self):
"""Returns whether this is a (non-quantized) integer type."""
return (
self.is_numpy_compatible
and not self.is_quantized
and np.issubdtype(self.as_numpy_dtype, np.integer)
) | def is_integer(self):
"""Returns whether this is a (non-quantized) integer type."""
return (
self.is_numpy_compatible
and not self.is_quantized
and np.issubdtype(self.as_numpy_dtype, np.integer)
) | [
"Returns",
"whether",
"this",
"is",
"a",
"(",
"non",
"-",
"quantized",
")",
"integer",
"type",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L143-L149 | [
"def",
"is_integer",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"is_numpy_compatible",
"and",
"not",
"self",
".",
"is_quantized",
"and",
"np",
".",
"issubdtype",
"(",
"self",
".",
"as_numpy_dtype",
",",
"np",
".",
"integer",
")",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.is_floating | Returns whether this is a (non-quantized, real) floating point type. | tensorboard/compat/tensorflow_stub/dtypes.py | def is_floating(self):
"""Returns whether this is a (non-quantized, real) floating point type."""
return (
self.is_numpy_compatible and np.issubdtype(self.as_numpy_dtype, np.floating)
) or self.base_dtype == bfloat16 | def is_floating(self):
"""Returns whether this is a (non-quantized, real) floating point type."""
return (
self.is_numpy_compatible and np.issubdtype(self.as_numpy_dtype, np.floating)
) or self.base_dtype == bfloat16 | [
"Returns",
"whether",
"this",
"is",
"a",
"(",
"non",
"-",
"quantized",
"real",
")",
"floating",
"point",
"type",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L152-L156 | [
"def",
"is_floating",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"is_numpy_compatible",
"and",
"np",
".",
"issubdtype",
"(",
"self",
".",
"as_numpy_dtype",
",",
"np",
".",
"floating",
")",
")",
"or",
"self",
".",
"base_dtype",
"==",
"bfloat16"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.min | Returns the minimum representable value in this data type.
Raises:
TypeError: if this is a non-numeric, unordered, or quantized type. | tensorboard/compat/tensorflow_stub/dtypes.py | def min(self):
"""Returns the minimum representable value in this data type.
Raises:
TypeError: if this is a non-numeric, unordered, or quantized type.
"""
if self.is_quantized or self.base_dtype in (
bool,
string,
complex64,
co... | def min(self):
"""Returns the minimum representable value in this data type.
Raises:
TypeError: if this is a non-numeric, unordered, or quantized type.
"""
if self.is_quantized or self.base_dtype in (
bool,
string,
complex64,
co... | [
"Returns",
"the",
"minimum",
"representable",
"value",
"in",
"this",
"data",
"type",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L184-L209 | [
"def",
"min",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_quantized",
"or",
"self",
".",
"base_dtype",
"in",
"(",
"bool",
",",
"string",
",",
"complex64",
",",
"complex128",
",",
")",
":",
"raise",
"TypeError",
"(",
"\"Cannot find minimum value of %s.\"",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.limits | Return intensity limits, i.e. (min, max) tuple, of the dtype.
Args:
clip_negative : bool, optional
If True, clip the negative range (i.e. return 0 for min intensity)
even if the image dtype allows negative values.
Returns
min, max : tuple
Lower... | tensorboard/compat/tensorflow_stub/dtypes.py | def limits(self, clip_negative=True):
"""Return intensity limits, i.e. (min, max) tuple, of the dtype.
Args:
clip_negative : bool, optional
If True, clip the negative range (i.e. return 0 for min intensity)
even if the image dtype allows negative values.
Ret... | def limits(self, clip_negative=True):
"""Return intensity limits, i.e. (min, max) tuple, of the dtype.
Args:
clip_negative : bool, optional
If True, clip the negative range (i.e. return 0 for min intensity)
even if the image dtype allows negative values.
Ret... | [
"Return",
"intensity",
"limits",
"i",
".",
"e",
".",
"(",
"min",
"max",
")",
"tuple",
"of",
"the",
"dtype",
".",
"Args",
":",
"clip_negative",
":",
"bool",
"optional",
"If",
"True",
"clip",
"the",
"negative",
"range",
"(",
"i",
".",
"e",
".",
"return... | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L240-L253 | [
"def",
"limits",
"(",
"self",
",",
"clip_negative",
"=",
"True",
")",
":",
"min",
",",
"max",
"=",
"dtype_range",
"[",
"self",
".",
"as_numpy_dtype",
"]",
"# pylint: disable=redefined-builtin",
"if",
"clip_negative",
":",
"min",
"=",
"0",
"# pylint: disable=rede... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | DType.is_compatible_with | Returns True if the `other` DType will be converted to this DType.
The conversion rules are as follows:
```python
DType(T) .is_compatible_with(DType(T)) == True
DType(T) .is_compatible_with(DType(T).as_ref) == True
DType(T).as_ref.is_compatible_with(DType(T))... | tensorboard/compat/tensorflow_stub/dtypes.py | def is_compatible_with(self, other):
"""Returns True if the `other` DType will be converted to this DType.
The conversion rules are as follows:
```python
DType(T) .is_compatible_with(DType(T)) == True
DType(T) .is_compatible_with(DType(T).as_ref) == True
... | def is_compatible_with(self, other):
"""Returns True if the `other` DType will be converted to this DType.
The conversion rules are as follows:
```python
DType(T) .is_compatible_with(DType(T)) == True
DType(T) .is_compatible_with(DType(T).as_ref) == True
... | [
"Returns",
"True",
"if",
"the",
"other",
"DType",
"will",
"be",
"converted",
"to",
"this",
"DType",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L255-L278 | [
"def",
"is_compatible_with",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dtype",
"(",
"other",
")",
"return",
"self",
".",
"_type_enum",
"in",
"(",
"other",
".",
"as_datatype_enum",
",",
"other",
".",
"base_dtype",
".",
"as_datatype_enum",
",",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | InteractiveDebuggerPlugin.listen | Start listening on the given gRPC port.
This method of an instance of InteractiveDebuggerPlugin can be invoked at
most once. This method is not thread safe.
Args:
grpc_port: port number to listen at.
Raises:
ValueError: If this instance is already listening at a gRPC port. | tensorboard/plugins/debugger/interactive_debugger_plugin.py | def listen(self, grpc_port):
"""Start listening on the given gRPC port.
This method of an instance of InteractiveDebuggerPlugin can be invoked at
most once. This method is not thread safe.
Args:
grpc_port: port number to listen at.
Raises:
ValueError: If this instance is already liste... | def listen(self, grpc_port):
"""Start listening on the given gRPC port.
This method of an instance of InteractiveDebuggerPlugin can be invoked at
most once. This method is not thread safe.
Args:
grpc_port: port number to listen at.
Raises:
ValueError: If this instance is already liste... | [
"Start",
"listening",
"on",
"the",
"given",
"gRPC",
"port",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/interactive_debugger_plugin.py#L80-L109 | [
"def",
"listen",
"(",
"self",
",",
"grpc_port",
")",
":",
"if",
"self",
".",
"_grpc_port",
":",
"raise",
"ValueError",
"(",
"'This InteractiveDebuggerPlugin instance is already listening at '",
"'gRPC port %d'",
"%",
"self",
".",
"_grpc_port",
")",
"self",
".",
"_gr... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | InteractiveDebuggerPlugin.get_plugin_apps | Obtains a mapping between routes and handlers.
This function also starts a debugger data server on separate thread if the
plugin has not started one yet.
Returns:
A mapping between routes and handlers (functions that respond to
requests). | tensorboard/plugins/debugger/interactive_debugger_plugin.py | def get_plugin_apps(self):
"""Obtains a mapping between routes and handlers.
This function also starts a debugger data server on separate thread if the
plugin has not started one yet.
Returns:
A mapping between routes and handlers (functions that respond to
requests).
"""
return {
... | def get_plugin_apps(self):
"""Obtains a mapping between routes and handlers.
This function also starts a debugger data server on separate thread if the
plugin has not started one yet.
Returns:
A mapping between routes and handlers (functions that respond to
requests).
"""
return {
... | [
"Obtains",
"a",
"mapping",
"between",
"routes",
"and",
"handlers",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/interactive_debugger_plugin.py#L131-L149 | [
"def",
"get_plugin_apps",
"(",
"self",
")",
":",
"return",
"{",
"_ACK_ROUTE",
":",
"self",
".",
"_serve_ack",
",",
"_COMM_ROUTE",
":",
"self",
".",
"_serve_comm",
",",
"_DEBUGGER_GRPC_HOST_PORT_ROUTE",
":",
"self",
".",
"_serve_debugger_grpc_host_port",
",",
"_DEB... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin.is_active | The audio plugin is active iff any run has at least one relevant tag. | tensorboard/plugins/audio/audio_plugin.py | def is_active(self):
"""The audio plugin is active iff any run has at least one relevant tag."""
if not self._multiplexer:
return False
return bool(self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)) | def is_active(self):
"""The audio plugin is active iff any run has at least one relevant tag."""
if not self._multiplexer:
return False
return bool(self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)) | [
"The",
"audio",
"plugin",
"is",
"active",
"iff",
"any",
"run",
"has",
"at",
"least",
"one",
"relevant",
"tag",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L59-L63 | [
"def",
"is_active",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_multiplexer",
":",
"return",
"False",
"return",
"bool",
"(",
"self",
".",
"_multiplexer",
".",
"PluginRunToTagToContent",
"(",
"metadata",
".",
"PLUGIN_NAME",
")",
")"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin._index_impl | Return information about the tags in each run.
Result is a dictionary of the form
{
"runName1": {
"tagName1": {
"displayName": "The first tag",
"description": "<p>Long ago there was just one tag...</p>",
"samples": 3
},
... | tensorboard/plugins/audio/audio_plugin.py | def _index_impl(self):
"""Return information about the tags in each run.
Result is a dictionary of the form
{
"runName1": {
"tagName1": {
"displayName": "The first tag",
"description": "<p>Long ago there was just one tag...</p>",
"samples... | def _index_impl(self):
"""Return information about the tags in each run.
Result is a dictionary of the form
{
"runName1": {
"tagName1": {
"displayName": "The first tag",
"description": "<p>Long ago there was just one tag...</p>",
"samples... | [
"Return",
"information",
"about",
"the",
"tags",
"in",
"each",
"run",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L65-L105 | [
"def",
"_index_impl",
"(",
"self",
")",
":",
"runs",
"=",
"self",
".",
"_multiplexer",
".",
"Runs",
"(",
")",
"result",
"=",
"{",
"run",
":",
"{",
"}",
"for",
"run",
"in",
"runs",
"}",
"mapping",
"=",
"self",
".",
"_multiplexer",
".",
"PluginRunToTag... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin._serve_audio_metadata | Given a tag and list of runs, serve a list of metadata for audio.
Note that the actual audio data are not sent; instead, we respond
with URLs to the audio. 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 change... | tensorboard/plugins/audio/audio_plugin.py | def _serve_audio_metadata(self, request):
"""Given a tag and list of runs, serve a list of metadata for audio.
Note that the actual audio data are not sent; instead, we respond
with URLs to the audio. The frontend should treat these URLs as
opaque and should not try to parse information about them or
... | def _serve_audio_metadata(self, request):
"""Given a tag and list of runs, serve a list of metadata for audio.
Note that the actual audio data are not sent; instead, we respond
with URLs to the audio. 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",
"audio",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L121-L141 | [
"def",
"_serve_audio_metadata",
"(",
"self",
",",
"request",
")",
":",
"tag",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'tag'",
")",
"run",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'run'",
")",
"sample",
"=",
"int",
"(",
"request",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin._audio_response_for_run | Builds a JSON-serializable object with information about audio.
Args:
tensor_events: A list of image event_accumulator.TensorEvent objects.
run: The name of the run.
tag: The name of the tag the audio entries all belong to.
sample: The zero-indexed sample of the audio sample for which to
... | tensorboard/plugins/audio/audio_plugin.py | def _audio_response_for_run(self, tensor_events, run, tag, sample):
"""Builds a JSON-serializable object with information about audio.
Args:
tensor_events: A list of image event_accumulator.TensorEvent objects.
run: The name of the run.
tag: The name of the tag the audio entries all belong to... | def _audio_response_for_run(self, tensor_events, run, tag, sample):
"""Builds a JSON-serializable object with information about audio.
Args:
tensor_events: A list of image event_accumulator.TensorEvent objects.
run: The name of the run.
tag: The name of the tag the audio entries all belong to... | [
"Builds",
"a",
"JSON",
"-",
"serializable",
"object",
"with",
"information",
"about",
"audio",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L143-L174 | [
"def",
"_audio_response_for_run",
"(",
"self",
",",
"tensor_events",
",",
"run",
",",
"tag",
",",
"sample",
")",
":",
"response",
"=",
"[",
"]",
"index",
"=",
"0",
"filtered_events",
"=",
"self",
".",
"_filter_by_sample",
"(",
"tensor_events",
",",
"sample",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin._query_for_individual_audio | Builds a URL for accessing the specified audio.
This should be kept in sync with _serve_audio_metadata. Note that the URL is
*not* guaranteed to always return the same audio, since audio may be
unloaded from the reservoir as new audio entries come in.
Args:
run: The name of the run.
tag: T... | tensorboard/plugins/audio/audio_plugin.py | def _query_for_individual_audio(self, run, tag, sample, index):
"""Builds a URL for accessing the specified audio.
This should be kept in sync with _serve_audio_metadata. Note that the URL is
*not* guaranteed to always return the same audio, since audio may be
unloaded from the reservoir as new audio e... | def _query_for_individual_audio(self, run, tag, sample, index):
"""Builds a URL for accessing the specified audio.
This should be kept in sync with _serve_audio_metadata. Note that the URL is
*not* guaranteed to always return the same audio, since audio may be
unloaded from the reservoir as new audio e... | [
"Builds",
"a",
"URL",
"for",
"accessing",
"the",
"specified",
"audio",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L176-L198 | [
"def",
"_query_for_individual_audio",
"(",
"self",
",",
"run",
",",
"tag",
",",
"sample",
",",
"index",
")",
":",
"query_string",
"=",
"urllib",
".",
"parse",
".",
"urlencode",
"(",
"{",
"'run'",
":",
"run",
",",
"'tag'",
":",
"tag",
",",
"'sample'",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | AudioPlugin._serve_individual_audio | Serve encoded audio data. | tensorboard/plugins/audio/audio_plugin.py | def _serve_individual_audio(self, request):
"""Serve encoded audio data."""
tag = request.args.get('tag')
run = request.args.get('run')
index = int(request.args.get('index'))
sample = int(request.args.get('sample', 0))
events = self._filter_by_sample(self._multiplexer.Tensors(run, tag), sample)
... | def _serve_individual_audio(self, request):
"""Serve encoded audio data."""
tag = request.args.get('tag')
run = request.args.get('run')
index = int(request.args.get('index'))
sample = int(request.args.get('sample', 0))
events = self._filter_by_sample(self._multiplexer.Tensors(run, tag), sample)
... | [
"Serve",
"encoded",
"audio",
"data",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L206-L215 | [
"def",
"_serve_individual_audio",
"(",
"self",
",",
"request",
")",
":",
"tag",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'tag'",
")",
"run",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'run'",
")",
"index",
"=",
"int",
"(",
"request",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _usage | Writes __main__'s docstring to stdout with some help text.
Args:
shorthelp: bool, if True, prints only flags from the main module,
rather than all flags. | tensorboard/compat/tensorflow_stub/app.py | def _usage(shorthelp):
"""Writes __main__'s docstring to stdout with some help text.
Args:
shorthelp: bool, if True, prints only flags from the main module,
rather than all flags.
"""
doc = _sys.modules['__main__'].__doc__
if not doc:
doc = '\nUSAGE: %s [flags]\n' % _sys.arg... | def _usage(shorthelp):
"""Writes __main__'s docstring to stdout with some help text.
Args:
shorthelp: bool, if True, prints only flags from the main module,
rather than all flags.
"""
doc = _sys.modules['__main__'].__doc__
if not doc:
doc = '\nUSAGE: %s [flags]\n' % _sys.arg... | [
"Writes",
"__main__",
"s",
"docstring",
"to",
"stdout",
"with",
"some",
"help",
"text",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/app.py#L27-L60 | [
"def",
"_usage",
"(",
"shorthelp",
")",
":",
"doc",
"=",
"_sys",
".",
"modules",
"[",
"'__main__'",
"]",
".",
"__doc__",
"if",
"not",
"doc",
":",
"doc",
"=",
"'\\nUSAGE: %s [flags]\\n'",
"%",
"_sys",
".",
"argv",
"[",
"0",
"]",
"doc",
"=",
"flags",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | run | Runs the program with an optional 'main' function and 'argv' list. | tensorboard/compat/tensorflow_stub/app.py | def run(main=None, argv=None):
"""Runs the program with an optional 'main' function and 'argv' list."""
# Define help flags.
_define_help_flags()
# Parse known flags.
argv = flags.FLAGS(_sys.argv if argv is None else argv, known_only=True)
main = main or _sys.modules['__main__'].main
# C... | def run(main=None, argv=None):
"""Runs the program with an optional 'main' function and 'argv' list."""
# Define help flags.
_define_help_flags()
# Parse known flags.
argv = flags.FLAGS(_sys.argv if argv is None else argv, known_only=True)
main = main or _sys.modules['__main__'].main
# C... | [
"Runs",
"the",
"program",
"with",
"an",
"optional",
"main",
"function",
"and",
"argv",
"list",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/app.py#L116-L129 | [
"def",
"run",
"(",
"main",
"=",
"None",
",",
"argv",
"=",
"None",
")",
":",
"# Define help flags.",
"_define_help_flags",
"(",
")",
"# Parse known flags.",
"argv",
"=",
"flags",
".",
"FLAGS",
"(",
"_sys",
".",
"argv",
"if",
"argv",
"is",
"None",
"else",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | op | Create a legacy image summary op for use in a TensorFlow graph.
Arguments:
name: A unique name for the generated summary node.
images: 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
width of the images, and `c` is th... | tensorboard/plugins/image/summary.py | def op(name,
images,
max_outputs=3,
display_name=None,
description=None,
collections=None):
"""Create a legacy image summary op for use in a TensorFlow graph.
Arguments:
name: A unique name for the generated summary node.
images: A `Tensor` representing pixel data with sh... | def op(name,
images,
max_outputs=3,
display_name=None,
description=None,
collections=None):
"""Create a legacy image summary op for use in a TensorFlow graph.
Arguments:
name: A unique name for the generated summary node.
images: A `Tensor` representing pixel data with sh... | [
"Create",
"a",
"legacy",
"image",
"summary",
"op",
"for",
"use",
"in",
"a",
"TensorFlow",
"graph",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary.py#L39-L92 | [
"def",
"op",
"(",
"name",
",",
"images",
",",
"max_outputs",
"=",
"3",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"collections",
"=",
"None",
")",
":",
"# TODO(nickfelt): remove on-demand imports once dep situation is fixed.",
"import",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | pb | Create a legacy image summary protobuf.
This behaves as if you were to create an `op` with the same arguments
(wrapped with constant tensors where appropriate) and then execute
that summary op in a TensorFlow session.
Arguments:
name: A unique name for the generated summary, including any desired
na... | tensorboard/plugins/image/summary.py | def pb(name, images, max_outputs=3, display_name=None, description=None):
"""Create a legacy image summary protobuf.
This behaves as if you were to create an `op` with the same arguments
(wrapped with constant tensors where appropriate) and then execute
that summary op in a TensorFlow session.
Arguments:
... | def pb(name, images, max_outputs=3, display_name=None, description=None):
"""Create a legacy image summary protobuf.
This behaves as if you were to create an `op` with the same arguments
(wrapped with constant tensors where appropriate) and then execute
that summary op in a TensorFlow session.
Arguments:
... | [
"Create",
"a",
"legacy",
"image",
"summary",
"protobuf",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary.py#L95-L145 | [
"def",
"pb",
"(",
"name",
",",
"images",
",",
"max_outputs",
"=",
"3",
",",
"display_name",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"# TODO(nickfelt): remove on-demand imports once dep situation is fixed.",
"import",
"tensorflow",
".",
"compat",
".",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | tensor_size_guidance_from_flags | Apply user per-summary size guidance overrides. | tensorboard/backend/application.py | def tensor_size_guidance_from_flags(flags):
"""Apply user per-summary size guidance overrides."""
tensor_size_guidance = dict(DEFAULT_TENSOR_SIZE_GUIDANCE)
if not flags or not flags.samples_per_plugin:
return tensor_size_guidance
for token in flags.samples_per_plugin.split(','):
k, v = token.strip().s... | def tensor_size_guidance_from_flags(flags):
"""Apply user per-summary size guidance overrides."""
tensor_size_guidance = dict(DEFAULT_TENSOR_SIZE_GUIDANCE)
if not flags or not flags.samples_per_plugin:
return tensor_size_guidance
for token in flags.samples_per_plugin.split(','):
k, v = token.strip().s... | [
"Apply",
"user",
"per",
"-",
"summary",
"size",
"guidance",
"overrides",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L80-L91 | [
"def",
"tensor_size_guidance_from_flags",
"(",
"flags",
")",
":",
"tensor_size_guidance",
"=",
"dict",
"(",
"DEFAULT_TENSOR_SIZE_GUIDANCE",
")",
"if",
"not",
"flags",
"or",
"not",
"flags",
".",
"samples_per_plugin",
":",
"return",
"tensor_size_guidance",
"for",
"token... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | standard_tensorboard_wsgi | Construct a TensorBoardWSGIApp with standard plugins and multiplexer.
Args:
flags: An argparse.Namespace containing TensorBoard CLI flags.
plugin_loaders: A list of TBLoader instances.
assets_zip_provider: See TBContext documentation for more information.
Returns:
The new TensorBoard WSGI applicat... | tensorboard/backend/application.py | def standard_tensorboard_wsgi(flags, plugin_loaders, assets_zip_provider):
"""Construct a TensorBoardWSGIApp with standard plugins and multiplexer.
Args:
flags: An argparse.Namespace containing TensorBoard CLI flags.
plugin_loaders: A list of TBLoader instances.
assets_zip_provider: See TBContext docum... | def standard_tensorboard_wsgi(flags, plugin_loaders, assets_zip_provider):
"""Construct a TensorBoardWSGIApp with standard plugins and multiplexer.
Args:
flags: An argparse.Namespace containing TensorBoard CLI flags.
plugin_loaders: A list of TBLoader instances.
assets_zip_provider: See TBContext docum... | [
"Construct",
"a",
"TensorBoardWSGIApp",
"with",
"standard",
"plugins",
"and",
"multiplexer",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L94-L160 | [
"def",
"standard_tensorboard_wsgi",
"(",
"flags",
",",
"plugin_loaders",
",",
"assets_zip_provider",
")",
":",
"multiplexer",
"=",
"event_multiplexer",
".",
"EventMultiplexer",
"(",
"size_guidance",
"=",
"DEFAULT_SIZE_GUIDANCE",
",",
"tensor_size_guidance",
"=",
"tensor_s... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | TensorBoardWSGIApp | Constructs the TensorBoard application.
Args:
logdir: the logdir spec that describes where data will be loaded.
may be a directory, or comma,separated list of directories, or colons
can be used to provide named directories
plugins: A list of base_plugin.TBPlugin subclass instances.
multiplexe... | tensorboard/backend/application.py | def TensorBoardWSGIApp(logdir, plugins, multiplexer, reload_interval,
path_prefix='', reload_task='auto'):
"""Constructs the TensorBoard application.
Args:
logdir: the logdir spec that describes where data will be loaded.
may be a directory, or comma,separated list of directories, ... | def TensorBoardWSGIApp(logdir, plugins, multiplexer, reload_interval,
path_prefix='', reload_task='auto'):
"""Constructs the TensorBoard application.
Args:
logdir: the logdir spec that describes where data will be loaded.
may be a directory, or comma,separated list of directories, ... | [
"Constructs",
"the",
"TensorBoard",
"application",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L163-L193 | [
"def",
"TensorBoardWSGIApp",
"(",
"logdir",
",",
"plugins",
",",
"multiplexer",
",",
"reload_interval",
",",
"path_prefix",
"=",
"''",
",",
"reload_task",
"=",
"'auto'",
")",
":",
"path_to_run",
"=",
"parse_event_files_spec",
"(",
"logdir",
")",
"if",
"reload_in... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | parse_event_files_spec | Parses `logdir` into a map from paths to run group names.
The events files flag format is a comma-separated list of path specifications.
A path specification either looks like 'group_name:/path/to/directory' or
'/path/to/directory'; in the latter case, the group is unnamed. Group names
cannot start with a forw... | tensorboard/backend/application.py | def parse_event_files_spec(logdir):
"""Parses `logdir` into a map from paths to run group names.
The events files flag format is a comma-separated list of path specifications.
A path specification either looks like 'group_name:/path/to/directory' or
'/path/to/directory'; in the latter case, the group is unname... | def parse_event_files_spec(logdir):
"""Parses `logdir` into a map from paths to run group names.
The events files flag format is a comma-separated list of path specifications.
A path specification either looks like 'group_name:/path/to/directory' or
'/path/to/directory'; in the latter case, the group is unname... | [
"Parses",
"logdir",
"into",
"a",
"map",
"from",
"paths",
"to",
"run",
"group",
"names",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L317-L357 | [
"def",
"parse_event_files_spec",
"(",
"logdir",
")",
":",
"files",
"=",
"{",
"}",
"if",
"logdir",
"is",
"None",
":",
"return",
"files",
"# Make sure keeping consistent with ParseURI in core/lib/io/path.cc",
"uri_pattern",
"=",
"re",
".",
"compile",
"(",
"'[a-zA-Z][0-9... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | start_reloading_multiplexer | Starts automatically reloading the given multiplexer.
If `load_interval` is positive, the thread will reload the multiplexer
by calling `ReloadMultiplexer` every `load_interval` seconds, starting
immediately. Otherwise, reloads the multiplexer once and never again.
Args:
multiplexer: The `EventMultiplexer... | tensorboard/backend/application.py | def start_reloading_multiplexer(multiplexer, path_to_run, load_interval,
reload_task):
"""Starts automatically reloading the given multiplexer.
If `load_interval` is positive, the thread will reload the multiplexer
by calling `ReloadMultiplexer` every `load_interval` seconds, star... | def start_reloading_multiplexer(multiplexer, path_to_run, load_interval,
reload_task):
"""Starts automatically reloading the given multiplexer.
If `load_interval` is positive, the thread will reload the multiplexer
by calling `ReloadMultiplexer` every `load_interval` seconds, star... | [
"Starts",
"automatically",
"reloading",
"the",
"given",
"multiplexer",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L360-L417 | [
"def",
"start_reloading_multiplexer",
"(",
"multiplexer",
",",
"path_to_run",
",",
"load_interval",
",",
"reload_task",
")",
":",
"if",
"load_interval",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'load_interval is negative: %d'",
"%",
"load_interval",
")",
"def",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | get_database_info | Returns TBContext fields relating to SQL database.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A tuple with the db_module and db_connection_provider TBContext fields. If
db_uri was empty, then (None, None) is returned.
Raises:
ValueError: If db_uri scheme ... | tensorboard/backend/application.py | def get_database_info(db_uri):
"""Returns TBContext fields relating to SQL database.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A tuple with the db_module and db_connection_provider TBContext fields. If
db_uri was empty, then (None, None) is returned.
Raise... | def get_database_info(db_uri):
"""Returns TBContext fields relating to SQL database.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A tuple with the db_module and db_connection_provider TBContext fields. If
db_uri was empty, then (None, None) is returned.
Raise... | [
"Returns",
"TBContext",
"fields",
"relating",
"to",
"SQL",
"database",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L420-L439 | [
"def",
"get_database_info",
"(",
"db_uri",
")",
":",
"if",
"not",
"db_uri",
":",
"return",
"None",
",",
"None",
"scheme",
"=",
"urlparse",
".",
"urlparse",
"(",
"db_uri",
")",
".",
"scheme",
"if",
"scheme",
"==",
"'sqlite'",
":",
"return",
"sqlite3",
","... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | create_sqlite_connection_provider | Returns function that returns SQLite Connection objects.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A function that returns a new PEP-249 DB Connection, which must be closed,
each time it is called.
Raises:
ValueError: If db_uri is not a valid sqlite file... | tensorboard/backend/application.py | def create_sqlite_connection_provider(db_uri):
"""Returns function that returns SQLite Connection objects.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A function that returns a new PEP-249 DB Connection, which must be closed,
each time it is called.
Raises:
... | def create_sqlite_connection_provider(db_uri):
"""Returns function that returns SQLite Connection objects.
Args:
db_uri: A string URI expressing the DB file, e.g. "sqlite:~/tb.db".
Returns:
A function that returns a new PEP-249 DB Connection, which must be closed,
each time it is called.
Raises:
... | [
"Returns",
"function",
"that",
"returns",
"SQLite",
"Connection",
"objects",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L442-L465 | [
"def",
"create_sqlite_connection_provider",
"(",
"db_uri",
")",
":",
"uri",
"=",
"urlparse",
".",
"urlparse",
"(",
"db_uri",
")",
"if",
"uri",
".",
"scheme",
"!=",
"'sqlite'",
":",
"raise",
"ValueError",
"(",
"'Scheme is not sqlite: '",
"+",
"db_uri",
")",
"if... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | TensorBoardWSGI._serve_plugins_listing | Serves an object mapping plugin name to whether it is enabled.
Args:
request: The werkzeug.Request object.
Returns:
A werkzeug.Response object. | tensorboard/backend/application.py | def _serve_plugins_listing(self, request):
"""Serves an object mapping plugin name to whether it is enabled.
Args:
request: The werkzeug.Request object.
Returns:
A werkzeug.Response object.
"""
response = {}
for plugin in self._plugins:
start = time.time()
response[plug... | def _serve_plugins_listing(self, request):
"""Serves an object mapping plugin name to whether it is enabled.
Args:
request: The werkzeug.Request object.
Returns:
A werkzeug.Response object.
"""
response = {}
for plugin in self._plugins:
start = time.time()
response[plug... | [
"Serves",
"an",
"object",
"mapping",
"plugin",
"name",
"to",
"whether",
"it",
"is",
"enabled",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L268-L285 | [
"def",
"_serve_plugins_listing",
"(",
"self",
",",
"request",
")",
":",
"response",
"=",
"{",
"}",
"for",
"plugin",
"in",
"self",
".",
"_plugins",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"response",
"[",
"plugin",
".",
"plugin_name",
"]",
"="... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | parse_time_indices | Parse a string as time indices.
Args:
s: A valid slicing string for time indices. E.g., '-1', '[:]', ':', '2:10'
Returns:
A slice object.
Raises:
ValueError: If `s` does not represent valid time indices. | tensorboard/plugins/debugger/tensor_helper.py | def parse_time_indices(s):
"""Parse a string as time indices.
Args:
s: A valid slicing string for time indices. E.g., '-1', '[:]', ':', '2:10'
Returns:
A slice object.
Raises:
ValueError: If `s` does not represent valid time indices.
"""
if not s.startswith('['):
s = '[' + s + ']'
parse... | def parse_time_indices(s):
"""Parse a string as time indices.
Args:
s: A valid slicing string for time indices. E.g., '-1', '[:]', ':', '2:10'
Returns:
A slice object.
Raises:
ValueError: If `s` does not represent valid time indices.
"""
if not s.startswith('['):
s = '[' + s + ']'
parse... | [
"Parse",
"a",
"string",
"as",
"time",
"indices",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L43-L62 | [
"def",
"parse_time_indices",
"(",
"s",
")",
":",
"if",
"not",
"s",
".",
"startswith",
"(",
"'['",
")",
":",
"s",
"=",
"'['",
"+",
"s",
"+",
"']'",
"parsed",
"=",
"command_parser",
".",
"_parse_slices",
"(",
"s",
")",
"if",
"len",
"(",
"parsed",
")"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | process_buffers_for_display | Process a buffer for human-readable display.
This function performs the following operation on each of the buffers in `s`.
1. Truncate input buffer if the length of the buffer is greater than
`limit`, to prevent large strings from overloading the frontend.
2. Apply `binascii.b2a_qp` on the truncated b... | tensorboard/plugins/debugger/tensor_helper.py | def process_buffers_for_display(s, limit=40):
"""Process a buffer for human-readable display.
This function performs the following operation on each of the buffers in `s`.
1. Truncate input buffer if the length of the buffer is greater than
`limit`, to prevent large strings from overloading the frontend... | def process_buffers_for_display(s, limit=40):
"""Process a buffer for human-readable display.
This function performs the following operation on each of the buffers in `s`.
1. Truncate input buffer if the length of the buffer is greater than
`limit`, to prevent large strings from overloading the frontend... | [
"Process",
"a",
"buffer",
"for",
"human",
"-",
"readable",
"display",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L83-L110 | [
"def",
"process_buffers_for_display",
"(",
"s",
",",
"limit",
"=",
"40",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"[",
"process_buffers_for_display",
"(",
"elem",
",",
"limit",
"=",
"limit",
")",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | array_view | View a slice or the entirety of an ndarray.
Args:
array: The input array, as an numpy.ndarray.
slicing: Optional slicing string, e.g., "[:, 1:3, :]".
mapping: Optional mapping string. Supported mappings:
`None` or case-insensitive `'None'`: Unmapped nested list.
`'image/png'`: Image encoding ... | tensorboard/plugins/debugger/tensor_helper.py | def array_view(array, slicing=None, mapping=None):
"""View a slice or the entirety of an ndarray.
Args:
array: The input array, as an numpy.ndarray.
slicing: Optional slicing string, e.g., "[:, 1:3, :]".
mapping: Optional mapping string. Supported mappings:
`None` or case-insensitive `'None'`: Un... | def array_view(array, slicing=None, mapping=None):
"""View a slice or the entirety of an ndarray.
Args:
array: The input array, as an numpy.ndarray.
slicing: Optional slicing string, e.g., "[:, 1:3, :]".
mapping: Optional mapping string. Supported mappings:
`None` or case-insensitive `'None'`: Un... | [
"View",
"a",
"slice",
"or",
"the",
"entirety",
"of",
"an",
"ndarray",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L113-L165 | [
"def",
"array_view",
"(",
"array",
",",
"slicing",
"=",
"None",
",",
"mapping",
"=",
"None",
")",
":",
"dtype",
"=",
"translate_dtype",
"(",
"array",
".",
"dtype",
")",
"sliced_array",
"=",
"(",
"array",
"[",
"command_parser",
".",
"_parse_slices",
"(",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | array_to_base64_png | Convert an array into base64-enoded PNG image.
Args:
array: A 2D np.ndarray or nested list of items.
Returns:
A base64-encoded string the image. The image is grayscale if the array is
2D. The image is RGB color if the image is 3D with lsat dimension equal to
3.
Raises:
ValueError: If the in... | tensorboard/plugins/debugger/tensor_helper.py | def array_to_base64_png(array):
"""Convert an array into base64-enoded PNG image.
Args:
array: A 2D np.ndarray or nested list of items.
Returns:
A base64-encoded string the image. The image is grayscale if the array is
2D. The image is RGB color if the image is 3D with lsat dimension equal to
3.... | def array_to_base64_png(array):
"""Convert an array into base64-enoded PNG image.
Args:
array: A 2D np.ndarray or nested list of items.
Returns:
A base64-encoded string the image. The image is grayscale if the array is
2D. The image is RGB color if the image is 3D with lsat dimension equal to
3.... | [
"Convert",
"an",
"array",
"into",
"base64",
"-",
"enoded",
"PNG",
"image",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L174-L223 | [
"def",
"array_to_base64_png",
"(",
"array",
")",
":",
"# TODO(cais): Deal with 3D case.",
"# TODO(cais): If there are None values in here, replace them with all NaNs.",
"array",
"=",
"np",
".",
"array",
"(",
"array",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"if",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _safe_copy_proto_list_values | Safely merge values from `src_proto_list` into `dst_proto_list`.
Each element in `dst_proto_list` must be mapped by `get_key` to a key
value that is unique within that list; likewise for `src_proto_list`.
If an element of `src_proto_list` has the same key as an existing
element in `dst_proto_list`, then the el... | tensorboard/plugins/graph/graph_util.py | def _safe_copy_proto_list_values(dst_proto_list, src_proto_list, get_key):
"""Safely merge values from `src_proto_list` into `dst_proto_list`.
Each element in `dst_proto_list` must be mapped by `get_key` to a key
value that is unique within that list; likewise for `src_proto_list`.
If an element of `src_proto_... | def _safe_copy_proto_list_values(dst_proto_list, src_proto_list, get_key):
"""Safely merge values from `src_proto_list` into `dst_proto_list`.
Each element in `dst_proto_list` must be mapped by `get_key` to a key
value that is unique within that list; likewise for `src_proto_list`.
If an element of `src_proto_... | [
"Safely",
"merge",
"values",
"from",
"src_proto_list",
"into",
"dst_proto_list",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graph_util.py#L27-L87 | [
"def",
"_safe_copy_proto_list_values",
"(",
"dst_proto_list",
",",
"src_proto_list",
",",
"get_key",
")",
":",
"def",
"_assert_proto_container_unique_keys",
"(",
"proto_list",
",",
"get_key",
")",
":",
"\"\"\"Asserts proto_list to only contains unique keys.\n\n Args:\n pr... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | combine_graph_defs | Combines two GraphDefs by adding nodes from from_proto into to_proto.
All GraphDefs are expected to be of TensorBoard's.
It assumes node names are unique across GraphDefs if contents differ. The
names can be the same if the NodeDef content are exactly the same.
Args:
to_proto: A destination TensorBoard Gr... | tensorboard/plugins/graph/graph_util.py | def combine_graph_defs(to_proto, from_proto):
"""Combines two GraphDefs by adding nodes from from_proto into to_proto.
All GraphDefs are expected to be of TensorBoard's.
It assumes node names are unique across GraphDefs if contents differ. The
names can be the same if the NodeDef content are exactly the same.
... | def combine_graph_defs(to_proto, from_proto):
"""Combines two GraphDefs by adding nodes from from_proto into to_proto.
All GraphDefs are expected to be of TensorBoard's.
It assumes node names are unique across GraphDefs if contents differ. The
names can be the same if the NodeDef content are exactly the same.
... | [
"Combines",
"two",
"GraphDefs",
"by",
"adding",
"nodes",
"from",
"from_proto",
"into",
"to_proto",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graph_util.py#L90-L150 | [
"def",
"combine_graph_defs",
"(",
"to_proto",
",",
"from_proto",
")",
":",
"if",
"from_proto",
".",
"version",
"!=",
"to_proto",
".",
"version",
":",
"raise",
"ValueError",
"(",
"'Cannot combine GraphDefs of different versions.'",
")",
"try",
":",
"_safe_copy_proto_li... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | scalar | Write a scalar 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 real numeric scalar value, convertible to a `float32` Tensor.
step: Explicit `int64`-castable monotonic step value for this summary. I... | tensorboard/plugins/scalar/summary_v2.py | def scalar(name, data, step=None, description=None):
"""Write a scalar 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 real numeric scalar value, convertible to a `float32` Tensor.
step: Explicit... | def scalar(name, data, step=None, description=None):
"""Write a scalar 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 real numeric scalar value, convertible to a `float32` Tensor.
step: Explicit... | [
"Write",
"a",
"scalar",
"summary",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/summary_v2.py#L32-L65 | [
"def",
"scalar",
"(",
"name",
",",
"data",
",",
"step",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"summary_metadata",
"=",
"metadata",
".",
"create_summary_metadata",
"(",
"display_name",
"=",
"None",
",",
"description",
"=",
"description",
")"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | scalar_pb | Create a scalar summary_pb2.Summary protobuf.
Arguments:
tag: String tag for the summary.
data: A 0-dimensional `np.array` or a compatible python number type.
description: Optional long-form description for this summary, as a
`str`. Markdown is supported. Defaults to empty.
Raises:
ValueErro... | tensorboard/plugins/scalar/summary_v2.py | def scalar_pb(tag, data, description=None):
"""Create a scalar summary_pb2.Summary protobuf.
Arguments:
tag: String tag for the summary.
data: A 0-dimensional `np.array` or a compatible python number type.
description: Optional long-form description for this summary, as a
`str`. Markdown is suppo... | def scalar_pb(tag, data, description=None):
"""Create a scalar summary_pb2.Summary protobuf.
Arguments:
tag: String tag for the summary.
data: A 0-dimensional `np.array` or a compatible python number type.
description: Optional long-form description for this summary, as a
`str`. Markdown is suppo... | [
"Create",
"a",
"scalar",
"summary_pb2",
".",
"Summary",
"protobuf",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/summary_v2.py#L68-L96 | [
"def",
"scalar_pb",
"(",
"tag",
",",
"data",
",",
"description",
"=",
"None",
")",
":",
"arr",
"=",
"np",
".",
"array",
"(",
"data",
")",
"if",
"arr",
".",
"shape",
"!=",
"(",
")",
":",
"raise",
"ValueError",
"(",
"'Expected scalar shape for tensor, got ... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | dump_data | Dumps plugin data to the log directory. | tensorboard/plugins/profile/profile_demo.py | def dump_data(logdir):
"""Dumps plugin data to the log directory."""
# Create a tfevents file in the logdir so it is detected as a run.
write_empty_event_file(logdir)
plugin_logdir = plugin_asset_util.PluginDirectory(
logdir, profile_plugin.ProfilePlugin.plugin_name)
_maybe_create_directory(plugin_logd... | def dump_data(logdir):
"""Dumps plugin data to the log directory."""
# Create a tfevents file in the logdir so it is detected as a run.
write_empty_event_file(logdir)
plugin_logdir = plugin_asset_util.PluginDirectory(
logdir, profile_plugin.ProfilePlugin.plugin_name)
_maybe_create_directory(plugin_logd... | [
"Dumps",
"plugin",
"data",
"to",
"the",
"log",
"directory",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_demo.py#L67-L102 | [
"def",
"dump_data",
"(",
"logdir",
")",
":",
"# Create a tfevents file in the logdir so it is detected as a run.",
"write_empty_event_file",
"(",
"logdir",
")",
"plugin_logdir",
"=",
"plugin_asset_util",
".",
"PluginDirectory",
"(",
"logdir",
",",
"profile_plugin",
".",
"Pr... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | calc_health_pill | Calculate health pill of a tensor.
Args:
tensor: An instance of `np.array` (for initialized tensors) or
`tensorflow.python.debug.lib.debug_data.InconvertibleTensorProto`
(for unininitialized tensors).
Returns:
If `tensor` is an initialized tensor of numeric or boolean types:
the calculat... | tensorboard/plugins/debugger/health_pill_calc.py | def calc_health_pill(tensor):
"""Calculate health pill of a tensor.
Args:
tensor: An instance of `np.array` (for initialized tensors) or
`tensorflow.python.debug.lib.debug_data.InconvertibleTensorProto`
(for unininitialized tensors).
Returns:
If `tensor` is an initialized tensor of numeric o... | def calc_health_pill(tensor):
"""Calculate health pill of a tensor.
Args:
tensor: An instance of `np.array` (for initialized tensors) or
`tensorflow.python.debug.lib.debug_data.InconvertibleTensorProto`
(for unininitialized tensors).
Returns:
If `tensor` is an initialized tensor of numeric o... | [
"Calculate",
"health",
"pill",
"of",
"a",
"tensor",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/health_pill_calc.py#L34-L118 | [
"def",
"calc_health_pill",
"(",
"tensor",
")",
":",
"health_pill",
"=",
"[",
"0.0",
"]",
"*",
"14",
"# TODO(cais): Add unit test for this method that compares results with",
"# DebugNumericSummary output.",
"# Is tensor initialized.",
"if",
"not",
"isinstance",
"(",
"tensor... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder._get_config | Reads the config file from disk or creates a new one. | tensorboard/plugins/beholder/beholder.py | def _get_config(self):
'''Reads the config file from disk or creates a new one.'''
filename = '{}/{}'.format(self.PLUGIN_LOGDIR, CONFIG_FILENAME)
modified_time = os.path.getmtime(filename)
if modified_time != self.config_last_modified_time:
config = read_pickle(filename, default=self.previous_con... | def _get_config(self):
'''Reads the config file from disk or creates a new one.'''
filename = '{}/{}'.format(self.PLUGIN_LOGDIR, CONFIG_FILENAME)
modified_time = os.path.getmtime(filename)
if modified_time != self.config_last_modified_time:
config = read_pickle(filename, default=self.previous_con... | [
"Reads",
"the",
"config",
"file",
"from",
"disk",
"or",
"creates",
"a",
"new",
"one",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L70-L82 | [
"def",
"_get_config",
"(",
"self",
")",
":",
"filename",
"=",
"'{}/{}'",
".",
"format",
"(",
"self",
".",
"PLUGIN_LOGDIR",
",",
"CONFIG_FILENAME",
")",
"modified_time",
"=",
"os",
".",
"path",
".",
"getmtime",
"(",
"filename",
")",
"if",
"modified_time",
"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder._write_summary | Writes the frame to disk as a tensor summary. | tensorboard/plugins/beholder/beholder.py | def _write_summary(self, session, frame):
'''Writes the frame to disk as a tensor summary.'''
summary = session.run(self.summary_op, feed_dict={
self.frame_placeholder: frame
})
path = '{}/{}'.format(self.PLUGIN_LOGDIR, SUMMARY_FILENAME)
write_file(summary, path) | def _write_summary(self, session, frame):
'''Writes the frame to disk as a tensor summary.'''
summary = session.run(self.summary_op, feed_dict={
self.frame_placeholder: frame
})
path = '{}/{}'.format(self.PLUGIN_LOGDIR, SUMMARY_FILENAME)
write_file(summary, path) | [
"Writes",
"the",
"frame",
"to",
"disk",
"as",
"a",
"tensor",
"summary",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L85-L91 | [
"def",
"_write_summary",
"(",
"self",
",",
"session",
",",
"frame",
")",
":",
"summary",
"=",
"session",
".",
"run",
"(",
"self",
".",
"summary_op",
",",
"feed_dict",
"=",
"{",
"self",
".",
"frame_placeholder",
":",
"frame",
"}",
")",
"path",
"=",
"'{}... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder._enough_time_has_passed | For limiting how often frames are computed. | tensorboard/plugins/beholder/beholder.py | def _enough_time_has_passed(self, FPS):
'''For limiting how often frames are computed.'''
if FPS == 0:
return False
else:
earliest_time = self.last_update_time + (1.0 / FPS)
return time.time() >= earliest_time | def _enough_time_has_passed(self, FPS):
'''For limiting how often frames are computed.'''
if FPS == 0:
return False
else:
earliest_time = self.last_update_time + (1.0 / FPS)
return time.time() >= earliest_time | [
"For",
"limiting",
"how",
"often",
"frames",
"are",
"computed",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L121-L127 | [
"def",
"_enough_time_has_passed",
"(",
"self",
",",
"FPS",
")",
":",
"if",
"FPS",
"==",
"0",
":",
"return",
"False",
"else",
":",
"earliest_time",
"=",
"self",
".",
"last_update_time",
"+",
"(",
"1.0",
"/",
"FPS",
")",
"return",
"time",
".",
"time",
"(... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder._update_recording | Adds a frame to the current video output. | tensorboard/plugins/beholder/beholder.py | def _update_recording(self, frame, config):
'''Adds a frame to the current video output.'''
# pylint: disable=redefined-variable-type
should_record = config['is_recording']
if should_record:
if not self.is_recording:
self.is_recording = True
logger.info(
'Starting reco... | def _update_recording(self, frame, config):
'''Adds a frame to the current video output.'''
# pylint: disable=redefined-variable-type
should_record = config['is_recording']
if should_record:
if not self.is_recording:
self.is_recording = True
logger.info(
'Starting reco... | [
"Adds",
"a",
"frame",
"to",
"the",
"current",
"video",
"output",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L138-L153 | [
"def",
"_update_recording",
"(",
"self",
",",
"frame",
",",
"config",
")",
":",
"# pylint: disable=redefined-variable-type",
"should_record",
"=",
"config",
"[",
"'is_recording'",
"]",
"if",
"should_record",
":",
"if",
"not",
"self",
".",
"is_recording",
":",
"sel... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder.update | Creates a frame and writes it to disk.
Args:
arrays: a list of np arrays. Use the "custom" option in the client.
frame: a 2D np array. This way the plugin can be used for video of any
kind, not just the visualization that comes with the plugin.
frame can also be a function, w... | tensorboard/plugins/beholder/beholder.py | def update(self, session, arrays=None, frame=None):
'''Creates a frame and writes it to disk.
Args:
arrays: a list of np arrays. Use the "custom" option in the client.
frame: a 2D np array. This way the plugin can be used for video of any
kind, not just the visualization that comes wit... | def update(self, session, arrays=None, frame=None):
'''Creates a frame and writes it to disk.
Args:
arrays: a list of np arrays. Use the "custom" option in the client.
frame: a 2D np array. This way the plugin can be used for video of any
kind, not just the visualization that comes wit... | [
"Creates",
"a",
"frame",
"and",
"writes",
"it",
"to",
"disk",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L158-L175 | [
"def",
"update",
"(",
"self",
",",
"session",
",",
"arrays",
"=",
"None",
",",
"frame",
"=",
"None",
")",
":",
"new_config",
"=",
"self",
".",
"_get_config",
"(",
")",
"if",
"self",
".",
"_enough_time_has_passed",
"(",
"self",
".",
"previous_config",
"["... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Beholder.gradient_helper | A helper to get the gradients out at each step.
Args:
optimizer: the optimizer op.
loss: the op that computes your loss value.
Returns: the gradient tensors and the train_step op. | tensorboard/plugins/beholder/beholder.py | def gradient_helper(optimizer, loss, var_list=None):
'''A helper to get the gradients out at each step.
Args:
optimizer: the optimizer op.
loss: the op that computes your loss value.
Returns: the gradient tensors and the train_step op.
'''
if var_list is None:
var_list = tf.compa... | def gradient_helper(optimizer, loss, var_list=None):
'''A helper to get the gradients out at each step.
Args:
optimizer: the optimizer op.
loss: the op that computes your loss value.
Returns: the gradient tensors and the train_step op.
'''
if var_list is None:
var_list = tf.compa... | [
"A",
"helper",
"to",
"get",
"the",
"gradients",
"out",
"at",
"each",
"step",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L181-L196 | [
"def",
"gradient_helper",
"(",
"optimizer",
",",
"loss",
",",
"var_list",
"=",
"None",
")",
":",
"if",
"var_list",
"is",
"None",
":",
"var_list",
"=",
"tf",
".",
"compat",
".",
"v1",
".",
"trainable_variables",
"(",
")",
"grads_and_vars",
"=",
"optimizer",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_key_func | Returns a key_func to be used in list.sort().
Returns a key_func to be used in list.sort() that sorts session groups
by the value extracted by extractor. 'None' extracted values will either
be considered largest or smallest as specified by the "none_is_largest"
boolean parameter.
Args:
extractor: An ext... | tensorboard/plugins/hparams/list_session_groups.py | def _create_key_func(extractor, none_is_largest):
"""Returns a key_func to be used in list.sort().
Returns a key_func to be used in list.sort() that sorts session groups
by the value extracted by extractor. 'None' extracted values will either
be considered largest or smallest as specified by the "none_is_large... | def _create_key_func(extractor, none_is_largest):
"""Returns a key_func to be used in list.sort().
Returns a key_func to be used in list.sort() that sorts session groups
by the value extracted by extractor. 'None' extracted values will either
be considered largest or smallest as specified by the "none_is_large... | [
"Returns",
"a",
"key_func",
"to",
"be",
"used",
"in",
"list",
".",
"sort",
"()",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L236-L259 | [
"def",
"_create_key_func",
"(",
"extractor",
",",
"none_is_largest",
")",
":",
"if",
"none_is_largest",
":",
"def",
"key_func_none_is_largest",
"(",
"session_group",
")",
":",
"value",
"=",
"extractor",
"(",
"session_group",
")",
"return",
"(",
"value",
"is",
"N... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_extractors | Creates extractors to extract properties corresponding to 'col_params'.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
Returns:
A list of extractor functions. The ith element in the
returned list extracts the column corresponding to the ith element of
_request.col_params | tensorboard/plugins/hparams/list_session_groups.py | def _create_extractors(col_params):
"""Creates extractors to extract properties corresponding to 'col_params'.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
Returns:
A list of extractor functions. The ith element in the
returned list extracts the column corresponding to the i... | def _create_extractors(col_params):
"""Creates extractors to extract properties corresponding to 'col_params'.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
Returns:
A list of extractor functions. The ith element in the
returned list extracts the column corresponding to the i... | [
"Creates",
"extractors",
"to",
"extract",
"properties",
"corresponding",
"to",
"col_params",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L264-L277 | [
"def",
"_create_extractors",
"(",
"col_params",
")",
":",
"result",
"=",
"[",
"]",
"for",
"col_param",
"in",
"col_params",
":",
"result",
".",
"append",
"(",
"_create_extractor",
"(",
"col_param",
")",
")",
"return",
"result"
] | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_metric_extractor | Returns function that extracts a metric from a session group or a session.
Args:
metric_name: tensorboard.hparams.MetricName protobuffer. Identifies the
metric to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.SessionGroup or
tensorborad.hparams.Session protobu... | tensorboard/plugins/hparams/list_session_groups.py | def _create_metric_extractor(metric_name):
"""Returns function that extracts a metric from a session group or a session.
Args:
metric_name: tensorboard.hparams.MetricName protobuffer. Identifies the
metric to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.Session... | def _create_metric_extractor(metric_name):
"""Returns function that extracts a metric from a session group or a session.
Args:
metric_name: tensorboard.hparams.MetricName protobuffer. Identifies the
metric to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.Session... | [
"Returns",
"function",
"that",
"extracts",
"a",
"metric",
"from",
"a",
"session",
"group",
"or",
"a",
"session",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L291-L307 | [
"def",
"_create_metric_extractor",
"(",
"metric_name",
")",
":",
"def",
"extractor_fn",
"(",
"session_or_group",
")",
":",
"metric_value",
"=",
"_find_metric_value",
"(",
"session_or_group",
",",
"metric_name",
")",
"return",
"metric_value",
".",
"value",
"if",
"met... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _find_metric_value | Returns the metric_value for a given metric in a session or session group.
Args:
session_or_group: A Session protobuffer or SessionGroup protobuffer.
metric_name: A MetricName protobuffer. The metric to search for.
Returns:
A MetricValue protobuffer representing the value of the given metric or
Non... | tensorboard/plugins/hparams/list_session_groups.py | def _find_metric_value(session_or_group, metric_name):
"""Returns the metric_value for a given metric in a session or session group.
Args:
session_or_group: A Session protobuffer or SessionGroup protobuffer.
metric_name: A MetricName protobuffer. The metric to search for.
Returns:
A MetricValue proto... | def _find_metric_value(session_or_group, metric_name):
"""Returns the metric_value for a given metric in a session or session group.
Args:
session_or_group: A Session protobuffer or SessionGroup protobuffer.
metric_name: A MetricName protobuffer. The metric to search for.
Returns:
A MetricValue proto... | [
"Returns",
"the",
"metric_value",
"for",
"a",
"given",
"metric",
"in",
"a",
"session",
"or",
"session",
"group",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L310-L327 | [
"def",
"_find_metric_value",
"(",
"session_or_group",
",",
"metric_name",
")",
":",
"# Note: We can speed this up by converting the metric_values field",
"# to a dictionary on initialization, to avoid a linear search here. We'll",
"# need to wrap the SessionGroup and Session protos in a python o... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_hparam_extractor | Returns an extractor function that extracts an hparam from a session group.
Args:
hparam_name: str. Identies the hparam to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.SessionGroup protobuffer and
returns the value, as a native Python object, of the hparam identi... | tensorboard/plugins/hparams/list_session_groups.py | def _create_hparam_extractor(hparam_name):
"""Returns an extractor function that extracts an hparam from a session group.
Args:
hparam_name: str. Identies the hparam to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.SessionGroup protobuffer and
returns the value,... | def _create_hparam_extractor(hparam_name):
"""Returns an extractor function that extracts an hparam from a session group.
Args:
hparam_name: str. Identies the hparam to extract from the session group.
Returns:
A function that takes a tensorboard.hparams.SessionGroup protobuffer and
returns the value,... | [
"Returns",
"an",
"extractor",
"function",
"that",
"extracts",
"an",
"hparam",
"from",
"a",
"session",
"group",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L330-L345 | [
"def",
"_create_hparam_extractor",
"(",
"hparam_name",
")",
":",
"def",
"extractor_fn",
"(",
"session_group",
")",
":",
"if",
"hparam_name",
"in",
"session_group",
".",
"hparams",
":",
"return",
"_value_to_python",
"(",
"session_group",
".",
"hparams",
"[",
"hpara... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_filters | Creates filters for the given col_params.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
extractors: list of extractor functions of the same length as col_params.
Each element should extract the column described by the corresponding
element of col_params.
Returns:
A ... | tensorboard/plugins/hparams/list_session_groups.py | def _create_filters(col_params, extractors):
"""Creates filters for the given col_params.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
extractors: list of extractor functions of the same length as col_params.
Each element should extract the column described by the correspond... | def _create_filters(col_params, extractors):
"""Creates filters for the given col_params.
Args:
col_params: List of ListSessionGroupsRequest.ColParam protobufs.
extractors: list of extractor functions of the same length as col_params.
Each element should extract the column described by the correspond... | [
"Creates",
"filters",
"for",
"the",
"given",
"col_params",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L352-L369 | [
"def",
"_create_filters",
"(",
"col_params",
",",
"extractors",
")",
":",
"result",
"=",
"[",
"]",
"for",
"col_param",
",",
"extractor",
"in",
"zip",
"(",
"col_params",
",",
"extractors",
")",
":",
"a_filter",
"=",
"_create_filter",
"(",
"col_param",
",",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_filter | Creates a filter for the given col_param and extractor.
Args:
col_param: A tensorboard.hparams.ColParams object identifying the column
and describing the filter to apply.
extractor: A function that extract the column value identified by
'col_param' from a tensorboard.hparams.SessionGroup protobuf... | tensorboard/plugins/hparams/list_session_groups.py | def _create_filter(col_param, extractor):
"""Creates a filter for the given col_param and extractor.
Args:
col_param: A tensorboard.hparams.ColParams object identifying the column
and describing the filter to apply.
extractor: A function that extract the column value identified by
'col_param' f... | def _create_filter(col_param, extractor):
"""Creates a filter for the given col_param and extractor.
Args:
col_param: A tensorboard.hparams.ColParams object identifying the column
and describing the filter to apply.
extractor: A function that extract the column value identified by
'col_param' f... | [
"Creates",
"a",
"filter",
"for",
"the",
"given",
"col_param",
"and",
"extractor",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L372-L407 | [
"def",
"_create_filter",
"(",
"col_param",
",",
"extractor",
")",
":",
"include_missing_values",
"=",
"not",
"col_param",
".",
"exclude_missing_values",
"if",
"col_param",
".",
"HasField",
"(",
"'filter_regexp'",
")",
":",
"value_filter_fn",
"=",
"_create_regexp_filte... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_regexp_filter | Returns a boolean function that filters strings based on a regular exp.
Args:
regex: A string describing the regexp to use.
Returns:
A function taking a string and returns True if any of its substrings
matches regex. | tensorboard/plugins/hparams/list_session_groups.py | def _create_regexp_filter(regex):
"""Returns a boolean function that filters strings based on a regular exp.
Args:
regex: A string describing the regexp to use.
Returns:
A function taking a string and returns True if any of its substrings
matches regex.
"""
# Warning: Note that python's regex lib... | def _create_regexp_filter(regex):
"""Returns a boolean function that filters strings based on a regular exp.
Args:
regex: A string describing the regexp to use.
Returns:
A function taking a string and returns True if any of its substrings
matches regex.
"""
# Warning: Note that python's regex lib... | [
"Returns",
"a",
"boolean",
"function",
"that",
"filters",
"strings",
"based",
"on",
"a",
"regular",
"exp",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L410-L431 | [
"def",
"_create_regexp_filter",
"(",
"regex",
")",
":",
"# Warning: Note that python's regex library allows inputs that take",
"# exponential time. Time-limiting it is difficult. When we move to",
"# a true multi-tenant tensorboard server, the regexp implementation here",
"# would need to be repla... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _create_interval_filter | Returns a function that checkes whether a number belongs to an interval.
Args:
interval: A tensorboard.hparams.Interval protobuf describing the interval.
Returns:
A function taking a number (a float or an object of a type in
six.integer_types) that returns True if the number belongs to (the closed)
... | tensorboard/plugins/hparams/list_session_groups.py | def _create_interval_filter(interval):
"""Returns a function that checkes whether a number belongs to an interval.
Args:
interval: A tensorboard.hparams.Interval protobuf describing the interval.
Returns:
A function taking a number (a float or an object of a type in
six.integer_types) that returns Tr... | def _create_interval_filter(interval):
"""Returns a function that checkes whether a number belongs to an interval.
Args:
interval: A tensorboard.hparams.Interval protobuf describing the interval.
Returns:
A function taking a number (a float or an object of a type in
six.integer_types) that returns Tr... | [
"Returns",
"a",
"function",
"that",
"checkes",
"whether",
"a",
"number",
"belongs",
"to",
"an",
"interval",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L434-L452 | [
"def",
"_create_interval_filter",
"(",
"interval",
")",
":",
"def",
"filter_fn",
"(",
"value",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"value",
",",
"six",
".",
"integer_types",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"float",
")",
")"... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _value_to_python | Converts a google.protobuf.Value to a native Python object. | tensorboard/plugins/hparams/list_session_groups.py | def _value_to_python(value):
"""Converts a google.protobuf.Value to a native Python object."""
assert isinstance(value, struct_pb2.Value)
field = value.WhichOneof('kind')
if field == 'number_value':
return value.number_value
elif field == 'string_value':
return value.string_value
elif field == 'boo... | def _value_to_python(value):
"""Converts a google.protobuf.Value to a native Python object."""
assert isinstance(value, struct_pb2.Value)
field = value.WhichOneof('kind')
if field == 'number_value':
return value.number_value
elif field == 'string_value':
return value.string_value
elif field == 'boo... | [
"Converts",
"a",
"google",
".",
"protobuf",
".",
"Value",
"to",
"a",
"native",
"Python",
"object",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L471-L483 | [
"def",
"_value_to_python",
"(",
"value",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"struct_pb2",
".",
"Value",
")",
"field",
"=",
"value",
".",
"WhichOneof",
"(",
"'kind'",
")",
"if",
"field",
"==",
"'number_value'",
":",
"return",
"value",
".",... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _set_avg_session_metrics | Sets the metrics for the group to be the average of its sessions.
The resulting session group metrics consist of the union of metrics across
the group's sessions. The value of each session group metric is the average
of that metric values across the sessions in the group. The 'step' and
'wall_time_secs' fields... | tensorboard/plugins/hparams/list_session_groups.py | def _set_avg_session_metrics(session_group):
"""Sets the metrics for the group to be the average of its sessions.
The resulting session group metrics consist of the union of metrics across
the group's sessions. The value of each session group metric is the average
of that metric values across the sessions in t... | def _set_avg_session_metrics(session_group):
"""Sets the metrics for the group to be the average of its sessions.
The resulting session group metrics consist of the union of metrics across
the group's sessions. The value of each session group metric is the average
of that metric values across the sessions in t... | [
"Sets",
"the",
"metrics",
"for",
"the",
"group",
"to",
"be",
"the",
"average",
"of",
"its",
"sessions",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L524-L558 | [
"def",
"_set_avg_session_metrics",
"(",
"session_group",
")",
":",
"assert",
"session_group",
".",
"sessions",
",",
"'SessionGroup cannot be empty.'",
"# Algorithm: Iterate over all (session, metric) pairs and maintain a",
"# dict from _MetricIdentifier to _MetricStats objects.",
"# Then... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _set_median_session_metrics | Sets the metrics for session_group to those of its "median session".
The median session is the session in session_group with the median value
of the metric given by 'aggregation_metric'. The median is taken over the
subset of sessions in the group whose 'aggregation_metric' was measured
at the largest training... | tensorboard/plugins/hparams/list_session_groups.py | def _set_median_session_metrics(session_group, aggregation_metric):
"""Sets the metrics for session_group to those of its "median session".
The median session is the session in session_group with the median value
of the metric given by 'aggregation_metric'. The median is taken over the
subset of sessions in th... | def _set_median_session_metrics(session_group, aggregation_metric):
"""Sets the metrics for session_group to those of its "median session".
The median session is the session in session_group with the median value
of the metric given by 'aggregation_metric'. The median is taken over the
subset of sessions in th... | [
"Sets",
"the",
"metrics",
"for",
"session_group",
"to",
"those",
"of",
"its",
"median",
"session",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L567-L584 | [
"def",
"_set_median_session_metrics",
"(",
"session_group",
",",
"aggregation_metric",
")",
":",
"measurements",
"=",
"sorted",
"(",
"_measurements",
"(",
"session_group",
",",
"aggregation_metric",
")",
",",
"key",
"=",
"operator",
".",
"attrgetter",
"(",
"'metric_... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _set_extremum_session_metrics | Sets the metrics for session_group to those of its "extremum session".
The extremum session is the session in session_group with the extremum value
of the metric given by 'aggregation_metric'. The extremum is taken over the
subset of sessions in the group whose 'aggregation_metric' was measured
at the largest ... | tensorboard/plugins/hparams/list_session_groups.py | def _set_extremum_session_metrics(session_group, aggregation_metric,
extremum_fn):
"""Sets the metrics for session_group to those of its "extremum session".
The extremum session is the session in session_group with the extremum value
of the metric given by 'aggregation_metric'. ... | def _set_extremum_session_metrics(session_group, aggregation_metric,
extremum_fn):
"""Sets the metrics for session_group to those of its "extremum session".
The extremum session is the session in session_group with the extremum value
of the metric given by 'aggregation_metric'. ... | [
"Sets",
"the",
"metrics",
"for",
"session_group",
"to",
"those",
"of",
"its",
"extremum",
"session",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L587-L608 | [
"def",
"_set_extremum_session_metrics",
"(",
"session_group",
",",
"aggregation_metric",
",",
"extremum_fn",
")",
":",
"measurements",
"=",
"_measurements",
"(",
"session_group",
",",
"aggregation_metric",
")",
"ext_session",
"=",
"extremum_fn",
"(",
"measurements",
","... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | _measurements | A generator for the values of the metric across the sessions in the group.
Args:
session_group: A SessionGroup protobuffer.
metric_name: A MetricName protobuffer.
Yields:
The next metric value wrapped in a _Measurement instance. | tensorboard/plugins/hparams/list_session_groups.py | def _measurements(session_group, metric_name):
"""A generator for the values of the metric across the sessions in the group.
Args:
session_group: A SessionGroup protobuffer.
metric_name: A MetricName protobuffer.
Yields:
The next metric value wrapped in a _Measurement instance.
"""
for session_in... | def _measurements(session_group, metric_name):
"""A generator for the values of the metric across the sessions in the group.
Args:
session_group: A SessionGroup protobuffer.
metric_name: A MetricName protobuffer.
Yields:
The next metric value wrapped in a _Measurement instance.
"""
for session_in... | [
"A",
"generator",
"for",
"the",
"values",
"of",
"the",
"metric",
"across",
"the",
"sessions",
"in",
"the",
"group",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L611-L624 | [
"def",
"_measurements",
"(",
"session_group",
",",
"metric_name",
")",
":",
"for",
"session_index",
",",
"session",
"in",
"enumerate",
"(",
"session_group",
".",
"sessions",
")",
":",
"metric_value",
"=",
"_find_metric_value",
"(",
"session",
",",
"metric_name",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler.run | Handles the request specified on construction.
Returns:
A ListSessionGroupsResponse object. | tensorboard/plugins/hparams/list_session_groups.py | def run(self):
"""Handles the request specified on construction.
Returns:
A ListSessionGroupsResponse object.
"""
session_groups = self._build_session_groups()
session_groups = self._filter(session_groups)
self._sort(session_groups)
return self._create_response(session_groups) | def run(self):
"""Handles the request specified on construction.
Returns:
A ListSessionGroupsResponse object.
"""
session_groups = self._build_session_groups()
session_groups = self._filter(session_groups)
self._sort(session_groups)
return self._create_response(session_groups) | [
"Handles",
"the",
"request",
"specified",
"on",
"construction",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L53-L63 | [
"def",
"run",
"(",
"self",
")",
":",
"session_groups",
"=",
"self",
".",
"_build_session_groups",
"(",
")",
"session_groups",
"=",
"self",
".",
"_filter",
"(",
"session_groups",
")",
"self",
".",
"_sort",
"(",
"session_groups",
")",
"return",
"self",
".",
... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._build_session_groups | Returns a list of SessionGroups protobuffers from the summary data. | tensorboard/plugins/hparams/list_session_groups.py | def _build_session_groups(self):
"""Returns a list of SessionGroups protobuffers from the summary data."""
# Algorithm: We keep a dict 'groups_by_name' mapping a SessionGroup name
# (str) to a SessionGroup protobuffer. We traverse the runs associated with
# the plugin--each representing a single sessio... | def _build_session_groups(self):
"""Returns a list of SessionGroups protobuffers from the summary data."""
# Algorithm: We keep a dict 'groups_by_name' mapping a SessionGroup name
# (str) to a SessionGroup protobuffer. We traverse the runs associated with
# the plugin--each representing a single sessio... | [
"Returns",
"a",
"list",
"of",
"SessionGroups",
"protobuffers",
"from",
"the",
"summary",
"data",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L65-L96 | [
"def",
"_build_session_groups",
"(",
"self",
")",
":",
"# Algorithm: We keep a dict 'groups_by_name' mapping a SessionGroup name",
"# (str) to a SessionGroup protobuffer. We traverse the runs associated with",
"# the plugin--each representing a single session. We form a Session",
"# protobuffer fr... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._add_session | Adds a new Session protobuffer to the 'groups_by_name' dictionary.
Called by _build_session_groups when we encounter a new session. Creates
the Session protobuffer and adds it to the relevant group in the
'groups_by_name' dict. Creates the session group if this is the first time
we encounter it.
A... | tensorboard/plugins/hparams/list_session_groups.py | def _add_session(self, session, start_info, groups_by_name):
"""Adds a new Session protobuffer to the 'groups_by_name' dictionary.
Called by _build_session_groups when we encounter a new session. Creates
the Session protobuffer and adds it to the relevant group in the
'groups_by_name' dict. Creates the... | def _add_session(self, session, start_info, groups_by_name):
"""Adds a new Session protobuffer to the 'groups_by_name' dictionary.
Called by _build_session_groups when we encounter a new session. Creates
the Session protobuffer and adds it to the relevant group in the
'groups_by_name' dict. Creates the... | [
"Adds",
"a",
"new",
"Session",
"protobuffer",
"to",
"the",
"groups_by_name",
"dictionary",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L98-L130 | [
"def",
"_add_session",
"(",
"self",
",",
"session",
",",
"start_info",
",",
"groups_by_name",
")",
":",
"# If the group_name is empty, this session's group contains only",
"# this session. Use the session name for the group name since session",
"# names are unique.",
"group_name",
"=... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._build_session | Builds a session object. | tensorboard/plugins/hparams/list_session_groups.py | def _build_session(self, name, start_info, end_info):
"""Builds a session object."""
assert start_info is not None
result = api_pb2.Session(
name=name,
start_time_secs=start_info.start_time_secs,
model_uri=start_info.model_uri,
metric_values=self._build_session_metric_values... | def _build_session(self, name, start_info, end_info):
"""Builds a session object."""
assert start_info is not None
result = api_pb2.Session(
name=name,
start_time_secs=start_info.start_time_secs,
model_uri=start_info.model_uri,
metric_values=self._build_session_metric_values... | [
"Builds",
"a",
"session",
"object",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L132-L145 | [
"def",
"_build_session",
"(",
"self",
",",
"name",
",",
"start_info",
",",
"end_info",
")",
":",
"assert",
"start_info",
"is",
"not",
"None",
"result",
"=",
"api_pb2",
".",
"Session",
"(",
"name",
"=",
"name",
",",
"start_time_secs",
"=",
"start_info",
"."... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._build_session_metric_values | Builds the session metric values. | tensorboard/plugins/hparams/list_session_groups.py | def _build_session_metric_values(self, session_name):
"""Builds the session metric values."""
# result is a list of api_pb2.MetricValue instances.
result = []
metric_infos = self._experiment.metric_infos
for metric_info in metric_infos:
metric_name = metric_info.name
try:
metric... | def _build_session_metric_values(self, session_name):
"""Builds the session metric values."""
# result is a list of api_pb2.MetricValue instances.
result = []
metric_infos = self._experiment.metric_infos
for metric_info in metric_infos:
metric_name = metric_info.name
try:
metric... | [
"Builds",
"the",
"session",
"metric",
"values",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L147-L170 | [
"def",
"_build_session_metric_values",
"(",
"self",
",",
"session_name",
")",
":",
"# result is a list of api_pb2.MetricValue instances.",
"result",
"=",
"[",
"]",
"metric_infos",
"=",
"self",
".",
"_experiment",
".",
"metric_infos",
"for",
"metric_info",
"in",
"metric_... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._aggregate_metrics | Sets the metrics of the group based on aggregation_type. | tensorboard/plugins/hparams/list_session_groups.py | def _aggregate_metrics(self, session_group):
"""Sets the metrics of the group based on aggregation_type."""
if (self._request.aggregation_type == api_pb2.AGGREGATION_AVG or
self._request.aggregation_type == api_pb2.AGGREGATION_UNSET):
_set_avg_session_metrics(session_group)
elif self._request... | def _aggregate_metrics(self, session_group):
"""Sets the metrics of the group based on aggregation_type."""
if (self._request.aggregation_type == api_pb2.AGGREGATION_AVG or
self._request.aggregation_type == api_pb2.AGGREGATION_UNSET):
_set_avg_session_metrics(session_group)
elif self._request... | [
"Sets",
"the",
"metrics",
"of",
"the",
"group",
"based",
"on",
"aggregation_type",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L172-L191 | [
"def",
"_aggregate_metrics",
"(",
"self",
",",
"session_group",
")",
":",
"if",
"(",
"self",
".",
"_request",
".",
"aggregation_type",
"==",
"api_pb2",
".",
"AGGREGATION_AVG",
"or",
"self",
".",
"_request",
".",
"aggregation_type",
"==",
"api_pb2",
".",
"AGGRE... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | Handler._sort | Sorts 'session_groups' in place according to _request.col_params. | tensorboard/plugins/hparams/list_session_groups.py | def _sort(self, session_groups):
"""Sorts 'session_groups' in place according to _request.col_params."""
# Sort by session_group name so we have a deterministic order.
session_groups.sort(key=operator.attrgetter('name'))
# Sort by lexicographical order of the _request.col_params whose order
# is no... | def _sort(self, session_groups):
"""Sorts 'session_groups' in place according to _request.col_params."""
# Sort by session_group name so we have a deterministic order.
session_groups.sort(key=operator.attrgetter('name'))
# Sort by lexicographical order of the _request.col_params whose order
# is no... | [
"Sorts",
"session_groups",
"in",
"place",
"according",
"to",
"_request",
".",
"col_params",
"."
] | tensorflow/tensorboard | python | https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L199-L226 | [
"def",
"_sort",
"(",
"self",
",",
"session_groups",
")",
":",
"# Sort by session_group name so we have a deterministic order.",
"session_groups",
".",
"sort",
"(",
"key",
"=",
"operator",
".",
"attrgetter",
"(",
"'name'",
")",
")",
"# Sort by lexicographical order of the ... | 8e5f497b48e40f2a774f85416b8a35ac0693c35e |
train | recordAnalyzeAudio | recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType)
This function is used to record and analyze audio segments, in a fix window basis.
ARGUMENTS:
- duration total recording duration
- outputWavFile path of the output WAV file
- midTermBufferSizeSec (fix)segment length in... | pyAudioAnalysis/audioAnalysisRecordAlsa.py | def recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType):
'''
recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType)
This function is used to record and analyze audio segments, in a fix window basis.
ARGUMENTS:
- duration total recording dura... | def recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType):
'''
recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType)
This function is used to record and analyze audio segments, in a fix window basis.
ARGUMENTS:
- duration total recording dura... | [
"recordAnalyzeAudio",
"(",
"duration",
"outputWavFile",
"midTermBufferSizeSec",
"modelName",
"modelType",
")"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioAnalysisRecordAlsa.py#L62-L125 | [
"def",
"recordAnalyzeAudio",
"(",
"duration",
",",
"outputWavFile",
",",
"midTermBufferSizeSec",
",",
"modelName",
",",
"modelType",
")",
":",
"if",
"modelType",
"==",
"'svm'",
":",
"[",
"Classifier",
",",
"MEAN",
",",
"STD",
",",
"classNames",
",",
"mtWin",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | annotation2files | Break an audio stream to segments of interest,
defined by a csv file
- wavFile: path to input wavfile
- csvFile: path to csvFile of segment limits
Input CSV file must be of the format <T1>\t<T2>\t<Label> | pyAudioAnalysis/audacityAnnotation2WAVs.py | def annotation2files(wavFile, csvFile):
'''
Break an audio stream to segments of interest,
defined by a csv file
- wavFile: path to input wavfile
- csvFile: path to csvFile of segment limits
Input CSV file must be of the format <T1>\t<T2>\t<Label>
... | def annotation2files(wavFile, csvFile):
'''
Break an audio stream to segments of interest,
defined by a csv file
- wavFile: path to input wavfile
- csvFile: path to csvFile of segment limits
Input CSV file must be of the format <T1>\t<T2>\t<Label>
... | [
"Break",
"an",
"audio",
"stream",
"to",
"segments",
"of",
"interest",
"defined",
"by",
"a",
"csv",
"file",
"-",
"wavFile",
":",
"path",
"to",
"input",
"wavfile",
"-",
"csvFile",
":",
"path",
"to",
"csvFile",
"of",
"segment",
"limits",
"Input",
"CSV",
"fi... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audacityAnnotation2WAVs.py#L9-L30 | [
"def",
"annotation2files",
"(",
"wavFile",
",",
"csvFile",
")",
":",
"[",
"Fs",
",",
"x",
"]",
"=",
"audioBasicIO",
".",
"readAudioFile",
"(",
"wavFile",
")",
"with",
"open",
"(",
"csvFile",
",",
"'rb'",
")",
"as",
"csvfile",
":",
"reader",
"=",
"csv",... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | convertDirMP3ToWav | This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used.
ARGUMENTS:
- dirName: the path of the folder where the MP3s are stored
- Fs: the sampling rate of the generated WAV files
... | pyAudioAnalysis/audioBasicIO.py | def convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False):
'''
This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used.
ARGUMENTS:
- dirName: the path of the folder where the MP3s... | def convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False):
'''
This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV files are based on MP3 tags, otherwise the same names are used.
ARGUMENTS:
- dirName: the path of the folder where the MP3s... | [
"This",
"function",
"converts",
"the",
"MP3",
"files",
"stored",
"in",
"a",
"folder",
"to",
"WAV",
".",
"If",
"required",
"the",
"output",
"names",
"of",
"the",
"WAV",
"files",
"are",
"based",
"on",
"MP3",
"tags",
"otherwise",
"the",
"same",
"names",
"ar... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L5-L38 | [
"def",
"convertDirMP3ToWav",
"(",
"dirName",
",",
"Fs",
",",
"nC",
",",
"useMp3TagsAsName",
"=",
"False",
")",
":",
"types",
"=",
"(",
"dirName",
"+",
"os",
".",
"sep",
"+",
"'*.mp3'",
",",
")",
"# the tuple of file types",
"filesToProcess",
"=",
"[",
"]",... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | convertFsDirWavToWav | This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels.
ARGUMENTS:
- dirName: the path of the folder where the WAVs are stored
- Fs: the sampling rate of the generated WAV files
- nC: the number of channesl of the ge... | pyAudioAnalysis/audioBasicIO.py | def convertFsDirWavToWav(dirName, Fs, nC):
'''
This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels.
ARGUMENTS:
- dirName: the path of the folder where the WAVs are stored
- Fs: the sampling rate of the generated WAV fil... | def convertFsDirWavToWav(dirName, Fs, nC):
'''
This function converts the WAV files stored in a folder to WAV using a different sampling freq and number of channels.
ARGUMENTS:
- dirName: the path of the folder where the WAVs are stored
- Fs: the sampling rate of the generated WAV fil... | [
"This",
"function",
"converts",
"the",
"WAV",
"files",
"stored",
"in",
"a",
"folder",
"to",
"WAV",
"using",
"a",
"different",
"sampling",
"freq",
"and",
"number",
"of",
"channels",
".",
"ARGUMENTS",
":",
"-",
"dirName",
":",
"the",
"path",
"of",
"the",
"... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L40-L64 | [
"def",
"convertFsDirWavToWav",
"(",
"dirName",
",",
"Fs",
",",
"nC",
")",
":",
"types",
"=",
"(",
"dirName",
"+",
"os",
".",
"sep",
"+",
"'*.wav'",
",",
")",
"# the tuple of file types",
"filesToProcess",
"=",
"[",
"]",
"for",
"files",
"in",
"types",
":"... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | readAudioFile | This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file | pyAudioAnalysis/audioBasicIO.py | def readAudioFile(path):
'''
This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file
'''
extension = os.path.splitext(path)[1]
try:
#if extension.lower() == '.wav':
#[Fs, x] = wavfile.read(path)
if extension.lower() == '.aif' or ... | def readAudioFile(path):
'''
This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file
'''
extension = os.path.splitext(path)[1]
try:
#if extension.lower() == '.wav':
#[Fs, x] = wavfile.read(path)
if extension.lower() == '.aif' or ... | [
"This",
"function",
"returns",
"a",
"numpy",
"array",
"that",
"stores",
"the",
"audio",
"samples",
"of",
"a",
"specified",
"WAV",
"of",
"AIFF",
"file"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L66-L112 | [
"def",
"readAudioFile",
"(",
"path",
")",
":",
"extension",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"[",
"1",
"]",
"try",
":",
"#if extension.lower() == '.wav':",
"#[Fs, x] = wavfile.read(path)",
"if",
"extension",
".",
"lower",
"(",
")",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | stereo2mono | This function converts the input signal
(stored in a numpy array) to MONO (if it is STEREO) | pyAudioAnalysis/audioBasicIO.py | def stereo2mono(x):
'''
This function converts the input signal
(stored in a numpy array) to MONO (if it is STEREO)
'''
if isinstance(x, int):
return -1
if x.ndim==1:
return x
elif x.ndim==2:
if x.shape[1]==1:
return x.flatten()
else:
i... | def stereo2mono(x):
'''
This function converts the input signal
(stored in a numpy array) to MONO (if it is STEREO)
'''
if isinstance(x, int):
return -1
if x.ndim==1:
return x
elif x.ndim==2:
if x.shape[1]==1:
return x.flatten()
else:
i... | [
"This",
"function",
"converts",
"the",
"input",
"signal",
"(",
"stored",
"in",
"a",
"numpy",
"array",
")",
"to",
"MONO",
"(",
"if",
"it",
"is",
"STEREO",
")"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L114-L130 | [
"def",
"stereo2mono",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"int",
")",
":",
"return",
"-",
"1",
"if",
"x",
".",
"ndim",
"==",
"1",
":",
"return",
"x",
"elif",
"x",
".",
"ndim",
"==",
"2",
":",
"if",
"x",
".",
"shape",
"[",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | selfSimilarityMatrix | This function computes the self-similarity matrix for a sequence
of feature vectors.
ARGUMENTS:
- featureVectors: a numpy matrix (nDims x nVectors) whose i-th column
corresponds to the i-th feature vector
RETURNS:
- S: the self-similarity matrix (nV... | pyAudioAnalysis/audioSegmentation.py | def selfSimilarityMatrix(featureVectors):
'''
This function computes the self-similarity matrix for a sequence
of feature vectors.
ARGUMENTS:
- featureVectors: a numpy matrix (nDims x nVectors) whose i-th column
corresponds to the i-th feature vector
RETURNS:
... | def selfSimilarityMatrix(featureVectors):
'''
This function computes the self-similarity matrix for a sequence
of feature vectors.
ARGUMENTS:
- featureVectors: a numpy matrix (nDims x nVectors) whose i-th column
corresponds to the i-th feature vector
RETURNS:
... | [
"This",
"function",
"computes",
"the",
"self",
"-",
"similarity",
"matrix",
"for",
"a",
"sequence",
"of",
"feature",
"vectors",
".",
"ARGUMENTS",
":",
"-",
"featureVectors",
":",
"a",
"numpy",
"matrix",
"(",
"nDims",
"x",
"nVectors",
")",
"whose",
"i",
"-"... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L38-L54 | [
"def",
"selfSimilarityMatrix",
"(",
"featureVectors",
")",
":",
"[",
"nDims",
",",
"nVectors",
"]",
"=",
"featureVectors",
".",
"shape",
"[",
"featureVectors2",
",",
"MEAN",
",",
"STD",
"]",
"=",
"aT",
".",
"normalizeFeatures",
"(",
"[",
"featureVectors",
".... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | flags2segs | ARGUMENTS:
- flags: a sequence of class flags (per time window)
- window: window duration (in seconds)
RETURNS:
- segs: a sequence of segment's limits: segs[i,0] is start and
segs[i,1] are start and end point of segment i
- classes: a sequence of class flags... | pyAudioAnalysis/audioSegmentation.py | def flags2segs(flags, window):
'''
ARGUMENTS:
- flags: a sequence of class flags (per time window)
- window: window duration (in seconds)
RETURNS:
- segs: a sequence of segment's limits: segs[i,0] is start and
segs[i,1] are start and end point of segment i
... | def flags2segs(flags, window):
'''
ARGUMENTS:
- flags: a sequence of class flags (per time window)
- window: window duration (in seconds)
RETURNS:
- segs: a sequence of segment's limits: segs[i,0] is start and
segs[i,1] are start and end point of segment i
... | [
"ARGUMENTS",
":",
"-",
"flags",
":",
"a",
"sequence",
"of",
"class",
"flags",
"(",
"per",
"time",
"window",
")",
"-",
"window",
":",
"window",
"duration",
"(",
"in",
"seconds",
")"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L57-L97 | [
"def",
"flags2segs",
"(",
"flags",
",",
"window",
")",
":",
"preFlag",
"=",
"0",
"cur_flag",
"=",
"0",
"n_segs",
"=",
"0",
"cur_val",
"=",
"flags",
"[",
"cur_flag",
"]",
"segsList",
"=",
"[",
"]",
"classes",
"=",
"[",
"]",
"while",
"(",
"cur_flag",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | segs2flags | This function converts segment endpoints and respective segment
labels to fix-sized class labels.
ARGUMENTS:
- seg_start: segment start points (in seconds)
- seg_end: segment endpoints (in seconds)
- seg_label: segment labels
- win_size: fix-sized window (in seconds)
RETURNS... | pyAudioAnalysis/audioSegmentation.py | def segs2flags(seg_start, seg_end, seg_label, win_size):
'''
This function converts segment endpoints and respective segment
labels to fix-sized class labels.
ARGUMENTS:
- seg_start: segment start points (in seconds)
- seg_end: segment endpoints (in seconds)
- seg_label: segment ... | def segs2flags(seg_start, seg_end, seg_label, win_size):
'''
This function converts segment endpoints and respective segment
labels to fix-sized class labels.
ARGUMENTS:
- seg_start: segment start points (in seconds)
- seg_end: segment endpoints (in seconds)
- seg_label: segment ... | [
"This",
"function",
"converts",
"segment",
"endpoints",
"and",
"respective",
"segment",
"labels",
"to",
"fix",
"-",
"sized",
"class",
"labels",
".",
"ARGUMENTS",
":",
"-",
"seg_start",
":",
"segment",
"start",
"points",
"(",
"in",
"seconds",
")",
"-",
"seg_e... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L100-L122 | [
"def",
"segs2flags",
"(",
"seg_start",
",",
"seg_end",
",",
"seg_label",
",",
"win_size",
")",
":",
"flags",
"=",
"[",
"]",
"class_names",
"=",
"list",
"(",
"set",
"(",
"seg_label",
")",
")",
"curPos",
"=",
"win_size",
"/",
"2.0",
"while",
"curPos",
"<... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | computePreRec | This function computes the precision, recall and f1 measures,
given a confusion matrix | pyAudioAnalysis/audioSegmentation.py | def computePreRec(cm, class_names):
'''
This function computes the precision, recall and f1 measures,
given a confusion matrix
'''
n_classes = cm.shape[0]
if len(class_names) != n_classes:
print("Error in computePreRec! Confusion matrix and class_names "
"list must be of th... | def computePreRec(cm, class_names):
'''
This function computes the precision, recall and f1 measures,
given a confusion matrix
'''
n_classes = cm.shape[0]
if len(class_names) != n_classes:
print("Error in computePreRec! Confusion matrix and class_names "
"list must be of th... | [
"This",
"function",
"computes",
"the",
"precision",
"recall",
"and",
"f1",
"measures",
"given",
"a",
"confusion",
"matrix"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L124-L141 | [
"def",
"computePreRec",
"(",
"cm",
",",
"class_names",
")",
":",
"n_classes",
"=",
"cm",
".",
"shape",
"[",
"0",
"]",
"if",
"len",
"(",
"class_names",
")",
"!=",
"n_classes",
":",
"print",
"(",
"\"Error in computePreRec! Confusion matrix and class_names \"",
"\"... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | readSegmentGT | This function reads a segmentation ground truth file, following a simple CSV format with the following columns:
<segment start>,<segment end>,<class label>
ARGUMENTS:
- gt_file: the path of the CSV segment file
RETURNS:
- seg_start: a numpy array of segments' start positions
- seg_... | pyAudioAnalysis/audioSegmentation.py | def readSegmentGT(gt_file):
'''
This function reads a segmentation ground truth file, following a simple CSV format with the following columns:
<segment start>,<segment end>,<class label>
ARGUMENTS:
- gt_file: the path of the CSV segment file
RETURNS:
- seg_start: a numpy array ... | def readSegmentGT(gt_file):
'''
This function reads a segmentation ground truth file, following a simple CSV format with the following columns:
<segment start>,<segment end>,<class label>
ARGUMENTS:
- gt_file: the path of the CSV segment file
RETURNS:
- seg_start: a numpy array ... | [
"This",
"function",
"reads",
"a",
"segmentation",
"ground",
"truth",
"file",
"following",
"a",
"simple",
"CSV",
"format",
"with",
"the",
"following",
"columns",
":",
"<segment",
"start",
">",
"<segment",
"end",
">",
"<class",
"label",
">"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L144-L170 | [
"def",
"readSegmentGT",
"(",
"gt_file",
")",
":",
"f",
"=",
"open",
"(",
"gt_file",
",",
"'rt'",
")",
"reader",
"=",
"csv",
".",
"reader",
"(",
"f",
",",
"delimiter",
"=",
"','",
")",
"seg_start",
"=",
"[",
"]",
"seg_end",
"=",
"[",
"]",
"seg_label... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | plotSegmentationResults | This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method.
It also computes the overall accuracy achieved by the respective method if ground-truth is available. | pyAudioAnalysis/audioSegmentation.py | def plotSegmentationResults(flags_ind, flags_ind_gt, class_names, mt_step, ONLY_EVALUATE=False):
'''
This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method.
It also computes the overall accuracy achieved by the respectiv... | def plotSegmentationResults(flags_ind, flags_ind_gt, class_names, mt_step, ONLY_EVALUATE=False):
'''
This function plots statistics on the classification-segmentation results produced either by the fix-sized supervised method or the HMM method.
It also computes the overall accuracy achieved by the respectiv... | [
"This",
"function",
"plots",
"statistics",
"on",
"the",
"classification",
"-",
"segmentation",
"results",
"produced",
"either",
"by",
"the",
"fix",
"-",
"sized",
"supervised",
"method",
"or",
"the",
"HMM",
"method",
".",
"It",
"also",
"computes",
"the",
"overa... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L173-L240 | [
"def",
"plotSegmentationResults",
"(",
"flags_ind",
",",
"flags_ind_gt",
",",
"class_names",
",",
"mt_step",
",",
"ONLY_EVALUATE",
"=",
"False",
")",
":",
"flags",
"=",
"[",
"class_names",
"[",
"int",
"(",
"f",
")",
"]",
"for",
"f",
"in",
"flags_ind",
"]",... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | trainHMM_computeStatistics | This function computes the statistics used to train an HMM joint segmentation-classification model
using a sequence of sequential features and respective labels
ARGUMENTS:
- features: a numpy matrix of feature vectors (numOfDimensions x n_wins)
- labels: a numpy array of class indices (n_wins x... | pyAudioAnalysis/audioSegmentation.py | def trainHMM_computeStatistics(features, labels):
'''
This function computes the statistics used to train an HMM joint segmentation-classification model
using a sequence of sequential features and respective labels
ARGUMENTS:
- features: a numpy matrix of feature vectors (numOfDimensions x n_wi... | def trainHMM_computeStatistics(features, labels):
'''
This function computes the statistics used to train an HMM joint segmentation-classification model
using a sequence of sequential features and respective labels
ARGUMENTS:
- features: a numpy matrix of feature vectors (numOfDimensions x n_wi... | [
"This",
"function",
"computes",
"the",
"statistics",
"used",
"to",
"train",
"an",
"HMM",
"joint",
"segmentation",
"-",
"classification",
"model",
"using",
"a",
"sequence",
"of",
"sequential",
"features",
"and",
"respective",
"labels"
] | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L278-L330 | [
"def",
"trainHMM_computeStatistics",
"(",
"features",
",",
"labels",
")",
":",
"u_labels",
"=",
"numpy",
".",
"unique",
"(",
"labels",
")",
"n_comps",
"=",
"len",
"(",
"u_labels",
")",
"n_feats",
"=",
"features",
".",
"shape",
"[",
"0",
"]",
"if",
"featu... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | trainHMM_fromFile | This function trains a HMM model for segmentation-classification using a single annotated audio file
ARGUMENTS:
- wav_file: the path of the audio filename
- gt_file: the path of the ground truth filename
(a csv file of the form <segment start in seconds>,<segment end ... | pyAudioAnalysis/audioSegmentation.py | def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step):
'''
This function trains a HMM model for segmentation-classification using a single annotated audio file
ARGUMENTS:
- wav_file: the path of the audio filename
- gt_file: the path of the ground truth filename
... | def trainHMM_fromFile(wav_file, gt_file, hmm_model_name, mt_win, mt_step):
'''
This function trains a HMM model for segmentation-classification using a single annotated audio file
ARGUMENTS:
- wav_file: the path of the audio filename
- gt_file: the path of the ground truth filename
... | [
"This",
"function",
"trains",
"a",
"HMM",
"model",
"for",
"segmentation",
"-",
"classification",
"using",
"a",
"single",
"annotated",
"audio",
"file",
"ARGUMENTS",
":",
"-",
"wav_file",
":",
"the",
"path",
"of",
"the",
"audio",
"filename",
"-",
"gt_file",
":... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L333-L370 | [
"def",
"trainHMM_fromFile",
"(",
"wav_file",
",",
"gt_file",
",",
"hmm_model_name",
",",
"mt_win",
",",
"mt_step",
")",
":",
"[",
"seg_start",
",",
"seg_end",
",",
"seg_labs",
"]",
"=",
"readSegmentGT",
"(",
"gt_file",
")",
"flags",
",",
"class_names",
"=",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | trainHMM_fromDir | This function trains a HMM model for segmentation-classification using
a where WAV files and .segment (ground-truth files) are stored
ARGUMENTS:
- dirPath: the path of the data diretory
- hmm_model_name: the name of the HMM model to be stored
- mt_win: mid-term window size
-... | pyAudioAnalysis/audioSegmentation.py | def trainHMM_fromDir(dirPath, hmm_model_name, mt_win, mt_step):
'''
This function trains a HMM model for segmentation-classification using
a where WAV files and .segment (ground-truth files) are stored
ARGUMENTS:
- dirPath: the path of the data diretory
- hmm_model_name: the name of ... | def trainHMM_fromDir(dirPath, hmm_model_name, mt_win, mt_step):
'''
This function trains a HMM model for segmentation-classification using
a where WAV files and .segment (ground-truth files) are stored
ARGUMENTS:
- dirPath: the path of the data diretory
- hmm_model_name: the name of ... | [
"This",
"function",
"trains",
"a",
"HMM",
"model",
"for",
"segmentation",
"-",
"classification",
"using",
"a",
"where",
"WAV",
"files",
"and",
".",
"segment",
"(",
"ground",
"-",
"truth",
"files",
")",
"are",
"stored",
"ARGUMENTS",
":",
"-",
"dirPath",
":"... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L373-L439 | [
"def",
"trainHMM_fromDir",
"(",
"dirPath",
",",
"hmm_model_name",
",",
"mt_win",
",",
"mt_step",
")",
":",
"flags_all",
"=",
"numpy",
".",
"array",
"(",
"[",
"]",
")",
"classes_all",
"=",
"[",
"]",
"for",
"i",
",",
"f",
"in",
"enumerate",
"(",
"glob",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | mtFileClassification | This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used, i.e. a pre-trained classifier.
ARGUMENTS:
- input_file: path of the input WAV file
- model_name: name of the classification model
- model_type: svm or k... | pyAudioAnalysis/audioSegmentation.py | def mtFileClassification(input_file, model_name, model_type,
plot_results=False, gt_file=""):
'''
This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used, i.e. a pre-trained classifier.
ARGUMENTS:
- input_file: ... | def mtFileClassification(input_file, model_name, model_type,
plot_results=False, gt_file=""):
'''
This function performs mid-term classification of an audio stream.
Towards this end, supervised knowledge is used, i.e. a pre-trained classifier.
ARGUMENTS:
- input_file: ... | [
"This",
"function",
"performs",
"mid",
"-",
"term",
"classification",
"of",
"an",
"audio",
"stream",
".",
"Towards",
"this",
"end",
"supervised",
"knowledge",
"is",
"used",
"i",
".",
"e",
".",
"a",
"pre",
"-",
"trained",
"classifier",
".",
"ARGUMENTS",
":"... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L491-L579 | [
"def",
"mtFileClassification",
"(",
"input_file",
",",
"model_name",
",",
"model_type",
",",
"plot_results",
"=",
"False",
",",
"gt_file",
"=",
"\"\"",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"model_name",
")",
":",
"print",
"(",
"\... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | silenceRemoval | Event Detection (silence removal)
ARGUMENTS:
- x: the input audio signal
- fs: sampling freq
- st_win, st_step: window size and step in seconds
- smoothWindow: (optinal) smooth window (in seconds)
- weight: (optinal) weight f... | pyAudioAnalysis/audioSegmentation.py | def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False):
'''
Event Detection (silence removal)
ARGUMENTS:
- x: the input audio signal
- fs: sampling freq
- st_win, st_step: window size and step in seconds
- smoo... | def silenceRemoval(x, fs, st_win, st_step, smoothWindow=0.5, weight=0.5, plot=False):
'''
Event Detection (silence removal)
ARGUMENTS:
- x: the input audio signal
- fs: sampling freq
- st_win, st_step: window size and step in seconds
- smoo... | [
"Event",
"Detection",
"(",
"silence",
"removal",
")",
"ARGUMENTS",
":",
"-",
"x",
":",
"the",
"input",
"audio",
"signal",
"-",
"fs",
":",
"sampling",
"freq",
"-",
"st_win",
"st_step",
":",
"window",
"size",
"and",
"step",
"in",
"seconds",
"-",
"smoothWin... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L625-L738 | [
"def",
"silenceRemoval",
"(",
"x",
",",
"fs",
",",
"st_win",
",",
"st_step",
",",
"smoothWindow",
"=",
"0.5",
",",
"weight",
"=",
"0.5",
",",
"plot",
"=",
"False",
")",
":",
"if",
"weight",
">=",
"1",
":",
"weight",
"=",
"0.99",
"if",
"weight",
"<=... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | speakerDiarization | ARGUMENTS:
- filename: the name of the WAV file to be analyzed
- n_speakers the number of speakers (clusters) in the recording (<=0 for unknown)
- mt_size (opt) mid-term window size
- mt_step (opt) mid-term window step
- st_win (opt) short-term window size
... | pyAudioAnalysis/audioSegmentation.py | def speakerDiarization(filename, n_speakers, mt_size=2.0, mt_step=0.2,
st_win=0.05, lda_dim=35, plot_res=False):
'''
ARGUMENTS:
- filename: the name of the WAV file to be analyzed
- n_speakers the number of speakers (clusters) in the recording (<=0 for unknown)
... | def speakerDiarization(filename, n_speakers, mt_size=2.0, mt_step=0.2,
st_win=0.05, lda_dim=35, plot_res=False):
'''
ARGUMENTS:
- filename: the name of the WAV file to be analyzed
- n_speakers the number of speakers (clusters) in the recording (<=0 for unknown)
... | [
"ARGUMENTS",
":",
"-",
"filename",
":",
"the",
"name",
"of",
"the",
"WAV",
"file",
"to",
"be",
"analyzed",
"-",
"n_speakers",
"the",
"number",
"of",
"speakers",
"(",
"clusters",
")",
"in",
"the",
"recording",
"(",
"<",
"=",
"0",
"for",
"unknown",
")",
... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L741-L988 | [
"def",
"speakerDiarization",
"(",
"filename",
",",
"n_speakers",
",",
"mt_size",
"=",
"2.0",
",",
"mt_step",
"=",
"0.2",
",",
"st_win",
"=",
"0.05",
",",
"lda_dim",
"=",
"35",
",",
"plot_res",
"=",
"False",
")",
":",
"[",
"fs",
",",
"x",
"]",
"=",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | speakerDiarizationEvaluateScript | This function prints the cluster purity and speaker purity for
each WAV file stored in a provided directory (.SEGMENT files
are needed as ground-truth)
ARGUMENTS:
- folder_name: the full path of the folder where the WAV and
SEGMENT (ground-truth) fi... | pyAudioAnalysis/audioSegmentation.py | def speakerDiarizationEvaluateScript(folder_name, ldas):
'''
This function prints the cluster purity and speaker purity for
each WAV file stored in a provided directory (.SEGMENT files
are needed as ground-truth)
ARGUMENTS:
- folder_name: the full path of the folder ... | def speakerDiarizationEvaluateScript(folder_name, ldas):
'''
This function prints the cluster purity and speaker purity for
each WAV file stored in a provided directory (.SEGMENT files
are needed as ground-truth)
ARGUMENTS:
- folder_name: the full path of the folder ... | [
"This",
"function",
"prints",
"the",
"cluster",
"purity",
"and",
"speaker",
"purity",
"for",
"each",
"WAV",
"file",
"stored",
"in",
"a",
"provided",
"directory",
"(",
".",
"SEGMENT",
"files",
"are",
"needed",
"as",
"ground",
"-",
"truth",
")",
"ARGUMENTS",
... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L990-L1021 | [
"def",
"speakerDiarizationEvaluateScript",
"(",
"folder_name",
",",
"ldas",
")",
":",
"types",
"=",
"(",
"'*.wav'",
",",
")",
"wavFilesList",
"=",
"[",
"]",
"for",
"files",
"in",
"types",
":",
"wavFilesList",
".",
"extend",
"(",
"glob",
".",
"glob",
"(",
... | e3da991e7247492deba50648a4c7c0f41e684af4 |
train | musicThumbnailing | This function detects instances of the most representative part of a
music recording, also called "music thumbnails".
A technique similar to the one proposed in [1], however a wider set of
audio features is used instead of chroma features.
In particular the following steps are followed:
- Extract s... | pyAudioAnalysis/audioSegmentation.py | def musicThumbnailing(x, fs, short_term_size=1.0, short_term_step=0.5,
thumb_size=10.0, limit_1 = 0, limit_2 = 1):
'''
This function detects instances of the most representative part of a
music recording, also called "music thumbnails".
A technique similar to the one proposed in [... | def musicThumbnailing(x, fs, short_term_size=1.0, short_term_step=0.5,
thumb_size=10.0, limit_1 = 0, limit_2 = 1):
'''
This function detects instances of the most representative part of a
music recording, also called "music thumbnails".
A technique similar to the one proposed in [... | [
"This",
"function",
"detects",
"instances",
"of",
"the",
"most",
"representative",
"part",
"of",
"a",
"music",
"recording",
"also",
"called",
"music",
"thumbnails",
".",
"A",
"technique",
"similar",
"to",
"the",
"one",
"proposed",
"in",
"[",
"1",
"]",
"howev... | tyiannak/pyAudioAnalysis | python | https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L1023-L1109 | [
"def",
"musicThumbnailing",
"(",
"x",
",",
"fs",
",",
"short_term_size",
"=",
"1.0",
",",
"short_term_step",
"=",
"0.5",
",",
"thumb_size",
"=",
"10.0",
",",
"limit_1",
"=",
"0",
",",
"limit_2",
"=",
"1",
")",
":",
"x",
"=",
"audioBasicIO",
".",
"stere... | e3da991e7247492deba50648a4c7c0f41e684af4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.