id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
32,100
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.ndims
def ndims(self): """Returns the rank of this shape, or None if it is unspecified.""" if self._dims is None: return None else: if self._ndims is None: self._ndims = len(self._dims) return self._ndims
python
def ndims(self): """Returns the rank of this shape, or None if it is unspecified.""" if self._dims is None: return None else: if self._ndims is None: self._ndims = len(self._dims) return self._ndims
[ "def", "ndims", "(", "self", ")", ":", "if", "self", ".", "_dims", "is", "None", ":", "return", "None", "else", ":", "if", "self", ".", "_ndims", "is", "None", ":", "self", ".", "_ndims", "=", "len", "(", "self", ".", "_dims", ")", "return", "sel...
Returns the rank of this shape, or None if it is unspecified.
[ "Returns", "the", "rank", "of", "this", "shape", "or", "None", "if", "it", "is", "unspecified", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L566-L573
32,101
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.num_elements
def num_elements(self): """Returns the total number of elements, or none for incomplete shapes.""" if self.is_fully_defined(): size = 1 for dim in self._dims: size *= dim.value return size else: return None
python
def num_elements(self): """Returns the total number of elements, or none for incomplete shapes.""" if self.is_fully_defined(): size = 1 for dim in self._dims: size *= dim.value return size else: return None
[ "def", "num_elements", "(", "self", ")", ":", "if", "self", ".", "is_fully_defined", "(", ")", ":", "size", "=", "1", "for", "dim", "in", "self", ".", "_dims", ":", "size", "*=", "dim", ".", "value", "return", "size", "else", ":", "return", "None" ]
Returns the total number of elements, or none for incomplete shapes.
[ "Returns", "the", "total", "number", "of", "elements", "or", "none", "for", "incomplete", "shapes", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L639-L647
32,102
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.merge_with
def merge_with(self, other): """Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Retu...
python
def merge_with(self, other): """Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Retu...
[ "def", "merge_with", "(", "self", ",", "other", ")", ":", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dims", "is", "None", ":", "return", "other", "else", ":", "try", ":", "self", ".", "assert_same_rank", "(", "other", ")", "new...
Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Returns: A `TensorShape` containin...
[ "Returns", "a", "TensorShape", "combining", "the", "information", "in", "self", "and", "other", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L649-L676
32,103
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.concatenate
def concatenate(self, other): """Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this ...
python
def concatenate(self, other): """Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this ...
[ "def", "concatenate", "(", "self", ",", "other", ")", ":", "# TODO(mrry): Handle the case where we concatenate a known shape with a", "# completely unknown shape, so that we can use the partial information.", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dim...
Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this information for use with slicing. ...
[ "Returns", "the", "concatenation", "of", "the", "dimension", "in", "self", "and", "other", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L678-L699
32,104
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.assert_same_rank
def assert_same_rank(self, other): """Raises an exception if `self` and `other` do not have convertible ranks. Args: other: Another `TensorShape`. Raises: ValueError: If `self` and `other` do not represent shapes with the same rank. """ other = a...
python
def assert_same_rank(self, other): """Raises an exception if `self` and `other` do not have convertible ranks. Args: other: Another `TensorShape`. Raises: ValueError: If `self` and `other` do not represent shapes with the same rank. """ other = a...
[ "def", "assert_same_rank", "(", "self", ",", "other", ")", ":", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "ndims", "is", "not", "None", "and", "other", ".", "ndims", "is", "not", "None", ":", "if", "self", ".", "ndims", "!=", ...
Raises an exception if `self` and `other` do not have convertible ranks. Args: other: Another `TensorShape`. Raises: ValueError: If `self` and `other` do not represent shapes with the same rank.
[ "Raises", "an", "exception", "if", "self", "and", "other", "do", "not", "have", "convertible", "ranks", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L701-L716
32,105
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.with_rank
def with_rank(self, rank): """Returns a shape based on `self` with the given rank. This method promotes a completely unknown shape to one with a known rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with the given rank....
python
def with_rank(self, rank): """Returns a shape based on `self` with the given rank. This method promotes a completely unknown shape to one with a known rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with the given rank....
[ "def", "with_rank", "(", "self", ",", "rank", ")", ":", "try", ":", "return", "self", ".", "merge_with", "(", "unknown_shape", "(", "ndims", "=", "rank", ")", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"Shape %s must have rank %d\"", "%"...
Returns a shape based on `self` with the given rank. This method promotes a completely unknown shape to one with a known rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with the given rank. Raises: ValueError...
[ "Returns", "a", "shape", "based", "on", "self", "with", "the", "given", "rank", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L730-L748
32,106
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.with_rank_at_least
def with_rank_at_least(self, rank): """Returns a shape based on `self` with at least the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at least the given rank. Raises: ValueError: If `self` does...
python
def with_rank_at_least(self, rank): """Returns a shape based on `self` with at least the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at least the given rank. Raises: ValueError: If `self` does...
[ "def", "with_rank_at_least", "(", "self", ",", "rank", ")", ":", "if", "self", ".", "ndims", "is", "not", "None", "and", "self", ".", "ndims", "<", "rank", ":", "raise", "ValueError", "(", "\"Shape %s must have rank at least %d\"", "%", "(", "self", ",", "...
Returns a shape based on `self` with at least the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at least the given rank. Raises: ValueError: If `self` does not represent a shape with at least the given ...
[ "Returns", "a", "shape", "based", "on", "self", "with", "at", "least", "the", "given", "rank", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L750-L767
32,107
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.with_rank_at_most
def with_rank_at_most(self, rank): """Returns a shape based on `self` with at most the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at most the given rank. Raises: ValueError: If `self` does no...
python
def with_rank_at_most(self, rank): """Returns a shape based on `self` with at most the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at most the given rank. Raises: ValueError: If `self` does no...
[ "def", "with_rank_at_most", "(", "self", ",", "rank", ")", ":", "if", "self", ".", "ndims", "is", "not", "None", "and", "self", ".", "ndims", ">", "rank", ":", "raise", "ValueError", "(", "\"Shape %s must have rank at most %d\"", "%", "(", "self", ",", "ra...
Returns a shape based on `self` with at most the given rank. Args: rank: An integer. Returns: A shape that is at least as specific as `self` with at most the given rank. Raises: ValueError: If `self` does not represent a shape with at most the given ...
[ "Returns", "a", "shape", "based", "on", "self", "with", "at", "most", "the", "given", "rank", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L769-L786
32,108
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.is_convertible_with
def is_convertible_with(self, other): """Returns True iff `self` is convertible with `other`. Two possibly-partially-defined shapes are convertible if there exists a fully-defined shape that both shapes can represent. Thus, convertibility allows the shape inference code to reason about ...
python
def is_convertible_with(self, other): """Returns True iff `self` is convertible with `other`. Two possibly-partially-defined shapes are convertible if there exists a fully-defined shape that both shapes can represent. Thus, convertibility allows the shape inference code to reason about ...
[ "def", "is_convertible_with", "(", "self", ",", "other", ")", ":", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dims", "is", "not", "None", "and", "other", ".", "dims", "is", "not", "None", ":", "if", "self", ".", "ndims", "!=", ...
Returns True iff `self` is convertible with `other`. Two possibly-partially-defined shapes are convertible if there exists a fully-defined shape that both shapes can represent. Thus, convertibility allows the shape inference code to reason about partially-defined shapes. For example: ...
[ "Returns", "True", "iff", "self", "is", "convertible", "with", "other", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L788-L833
32,109
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.most_specific_convertible_shape
def most_specific_convertible_shape(self, other): """Returns the most specific TensorShape convertible with `self` and `other`. * TensorShape([None, 1]) is the most specific TensorShape convertible with both TensorShape([2, 1]) and TensorShape([5, 1]). Note that TensorShape(None) is...
python
def most_specific_convertible_shape(self, other): """Returns the most specific TensorShape convertible with `self` and `other`. * TensorShape([None, 1]) is the most specific TensorShape convertible with both TensorShape([2, 1]) and TensorShape([5, 1]). Note that TensorShape(None) is...
[ "def", "most_specific_convertible_shape", "(", "self", ",", "other", ")", ":", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dims", "is", "None", "or", "other", ".", "dims", "is", "None", "or", "self", ".", "ndims", "!=", "other", "...
Returns the most specific TensorShape convertible with `self` and `other`. * TensorShape([None, 1]) is the most specific TensorShape convertible with both TensorShape([2, 1]) and TensorShape([5, 1]). Note that TensorShape(None) is also convertible with above mentioned TensorShapes. ...
[ "Returns", "the", "most", "specific", "TensorShape", "convertible", "with", "self", "and", "other", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L850-L878
32,110
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.is_fully_defined
def is_fully_defined(self): """Returns True iff `self` is fully defined in every dimension.""" return self._dims is not None and all( dim.value is not None for dim in self._dims )
python
def is_fully_defined(self): """Returns True iff `self` is fully defined in every dimension.""" return self._dims is not None and all( dim.value is not None for dim in self._dims )
[ "def", "is_fully_defined", "(", "self", ")", ":", "return", "self", ".", "_dims", "is", "not", "None", "and", "all", "(", "dim", ".", "value", "is", "not", "None", "for", "dim", "in", "self", ".", "_dims", ")" ]
Returns True iff `self` is fully defined in every dimension.
[ "Returns", "True", "iff", "self", "is", "fully", "defined", "in", "every", "dimension", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L880-L884
32,111
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.as_list
def as_list(self): """Returns a list of integers or `None` for each dimension. Returns: A list of integers or `None` for each dimension. Raises: ValueError: If `self` is an unknown shape with an unknown rank. """ if self._dims is None: raise Valu...
python
def as_list(self): """Returns a list of integers or `None` for each dimension. Returns: A list of integers or `None` for each dimension. Raises: ValueError: If `self` is an unknown shape with an unknown rank. """ if self._dims is None: raise Valu...
[ "def", "as_list", "(", "self", ")", ":", "if", "self", ".", "_dims", "is", "None", ":", "raise", "ValueError", "(", "\"as_list() is not defined on an unknown TensorShape.\"", ")", "return", "[", "dim", ".", "value", "for", "dim", "in", "self", ".", "_dims", ...
Returns a list of integers or `None` for each dimension. Returns: A list of integers or `None` for each dimension. Raises: ValueError: If `self` is an unknown shape with an unknown rank.
[ "Returns", "a", "list", "of", "integers", "or", "None", "for", "each", "dimension", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L895-L906
32,112
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
TensorShape.as_proto
def as_proto(self): """Returns this shape as a `TensorShapeProto`.""" if self._dims is None: return tensor_shape_pb2.TensorShapeProto(unknown_rank=True) else: return tensor_shape_pb2.TensorShapeProto( dim=[ tensor_shape_pb2.TensorShapeP...
python
def as_proto(self): """Returns this shape as a `TensorShapeProto`.""" if self._dims is None: return tensor_shape_pb2.TensorShapeProto(unknown_rank=True) else: return tensor_shape_pb2.TensorShapeProto( dim=[ tensor_shape_pb2.TensorShapeP...
[ "def", "as_proto", "(", "self", ")", ":", "if", "self", ".", "_dims", "is", "None", ":", "return", "tensor_shape_pb2", ".", "TensorShapeProto", "(", "unknown_rank", "=", "True", ")", "else", ":", "return", "tensor_shape_pb2", ".", "TensorShapeProto", "(", "d...
Returns this shape as a `TensorShapeProto`.
[ "Returns", "this", "shape", "as", "a", "TensorShapeProto", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L908-L920
32,113
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/utils/common_utils.py
convert_predict_response
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...
python
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", ")", ":", "output", "=", "pred", ".", "outputs", "[", "serving_bundle", ".", "predict_output_tensor", "]", "raw_output", "=", "output", ".", "float_val", "if", "serving_bundle", ".", "model_typ...
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...
[ "Converts", "a", "PredictResponse", "to", "ClassificationResponse", "or", "RegressionResponse", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/utils/common_utils.py#L39-L59
32,114
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/utils/common_utils.py
convert_prediction_values
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 ...
python
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", ")", ":", "if", "serving_bundle", ".", "model_type", "==", "'classification'", ":", "response", "=", "classification_pb2", ".", "ClassificationResponse", "(", "...
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...
[ "Converts", "tensor", "values", "into", "ClassificationResponse", "or", "RegressionResponse", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/utils/common_utils.py#L61-L91
32,115
tensorflow/tensorboard
tensorboard/plugins/graph/keras_util.py
_update_dicts
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...
python
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", ")", ":", "layer_config", "=", "model_layer", ".", "get", "(", "'config'", ")", "if", "not", "layer_config", ".", "get", ...
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...
[ "Updates", "input_to_in_layer", "model_name_to_output", "and", "prev_node_name", "based", "on", "the", "model_layer", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L114-L177
32,116
tensorflow/tensorboard
tensorboard/plugins/graph/keras_util.py
keras_model_to_graph_def
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. """ ...
python
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", ")", ":", "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...
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", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/keras_util.py#L180-L239
32,117
tensorflow/tensorboard
tensorboard/plugins/hparams/hparams_plugin.py
HParamsPlugin.is_active
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...
python
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", ")", ":", "if", "not", "self", ".", "_context", ".", "multiplexer", ":", "return", "False", "scalars_plugin", "=", "self", ".", "_get_scalars_plugin", "(", ")", "if", "not", "scalars_plugin", "or", "not", "scalars_plugin", "....
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.
[ "Returns", "True", "if", "the", "hparams", "plugin", "is", "active", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_plugin.py#L71-L84
32,118
tensorflow/tensorboard
tensorboard/plugin_util.py
markdown_to_safe_html
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 =...
python
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", ")", ":", "warning", "=", "''", "# Convert to utf-8 whenever we have a binary input.", "if", "isinstance", "(", "markdown_string", ",", "six", ".", "binary_type", ")", ":", "markdown_string_decoded", "=", "markdown_s...
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.
[ "Convert", "Markdown", "to", "HTML", "that", "s", "safe", "to", "splice", "into", "the", "DOM", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugin_util.py#L61-L87
32,119
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/dtypes.py
as_dtype
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), ...
python
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", ")", ":", "if", "isinstance", "(", "type_value", ",", "DType", ")", ":", "return", "type_value", "try", ":", "return", "_INTERN_TABLE", "[", "type_value", "]", "except", "KeyError", ":", "pass", "try", ":", "return", "...
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....
[ "Converts", "the", "given", "type_value", "to", "a", "DType", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L639-L690
32,120
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/dtypes.py
DType.real_dtype
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
python
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", ")", ":", "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.
[ "Returns", "the", "dtype", "correspond", "to", "this", "dtype", "s", "real", "part", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L113-L121
32,121
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/dtypes.py
DType.min
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...
python
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", ")", ":", "if", "self", ".", "is_quantized", "or", "self", ".", "base_dtype", "in", "(", "bool", ",", "string", ",", "complex64", ",", "complex128", ",", ")", ":", "raise", "TypeError", "(", "\"Cannot find minimum value of %s.\"", ...
Returns the minimum representable value in this data type. Raises: TypeError: if this is a non-numeric, unordered, or quantized type.
[ "Returns", "the", "minimum", "representable", "value", "in", "this", "data", "type", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L184-L209
32,122
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/dtypes.py
DType.is_compatible_with
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 ...
python
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", ")", ":", "other", "=", "as_dtype", "(", "other", ")", "return", "self", ".", "_type_enum", "in", "(", "other", ".", "as_datatype_enum", ",", "other", ".", "base_dtype", ".", "as_datatype_enum", ",", ...
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))...
[ "Returns", "True", "if", "the", "other", "DType", "will", "be", "converted", "to", "this", "DType", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/dtypes.py#L255-L278
32,123
tensorflow/tensorboard
tensorboard/plugins/debugger/interactive_debugger_plugin.py
InteractiveDebuggerPlugin.get_plugin_apps
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 { ...
python
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", ")", ":", "return", "{", "_ACK_ROUTE", ":", "self", ".", "_serve_ack", ",", "_COMM_ROUTE", ":", "self", ".", "_serve_comm", ",", "_DEBUGGER_GRPC_HOST_PORT_ROUTE", ":", "self", ".", "_serve_debugger_grpc_host_port", ",", "_DEB...
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).
[ "Obtains", "a", "mapping", "between", "routes", "and", "handlers", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/interactive_debugger_plugin.py#L131-L149
32,124
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin.is_active
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))
python
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", ")", ":", "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.
[ "The", "audio", "plugin", "is", "active", "iff", "any", "run", "has", "at", "least", "one", "relevant", "tag", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L59-L63
32,125
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin._index_impl
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...
python
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", ")", ":", "runs", "=", "self", ".", "_multiplexer", ".", "Runs", "(", ")", "result", "=", "{", "run", ":", "{", "}", "for", "run", "in", "runs", "}", "mapping", "=", "self", ".", "_multiplexer", ".", "PluginRunToTag...
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 }, ...
[ "Return", "information", "about", "the", "tags", "in", "each", "run", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L65-L105
32,126
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin._serve_audio_metadata
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 ...
python
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", ")", ":", "tag", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "sample", "=", "int", "(", "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 generate them itself, as the format may change...
[ "Given", "a", "tag", "and", "list", "of", "runs", "serve", "a", "list", "of", "metadata", "for", "audio", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L121-L141
32,127
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin._audio_response_for_run
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...
python
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", ")", ":", "response", "=", "[", "]", "index", "=", "0", "filtered_events", "=", "self", ".", "_filter_by_sample", "(", "tensor_events", ",", "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. sample: The zero-indexed sample of the audio sample for which to ...
[ "Builds", "a", "JSON", "-", "serializable", "object", "with", "information", "about", "audio", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L143-L174
32,128
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin._query_for_individual_audio
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...
python
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", ")", ":", "query_string", "=", "urllib", ".", "parse", ".", "urlencode", "(", "{", "'run'", ":", "run", ",", "'tag'", ":", "tag", ",", "'sample'", "...
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...
[ "Builds", "a", "URL", "for", "accessing", "the", "specified", "audio", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L176-L198
32,129
tensorflow/tensorboard
tensorboard/plugins/audio/audio_plugin.py
AudioPlugin._serve_individual_audio
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) ...
python
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", ")", ":", "tag", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "index", "=", "int", "(", "request", ".", ...
Serve encoded audio data.
[ "Serve", "encoded", "audio", "data", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/audio/audio_plugin.py#L206-L215
32,130
tensorflow/tensorboard
tensorboard/plugins/image/summary.py
op
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...
python
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", ")", ":", "# TODO(nickfelt): remove on-demand imports once dep situation is fixed.", "import", ...
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...
[ "Create", "a", "legacy", "image", "summary", "op", "for", "use", "in", "a", "TensorFlow", "graph", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary.py#L39-L92
32,131
tensorflow/tensorboard
tensorboard/plugins/image/summary.py
pb
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: ...
python
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", ")", ":", "# TODO(nickfelt): remove on-demand imports once dep situation is fixed.", "import", "tensorflow", ".", "compat", ".",...
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...
[ "Create", "a", "legacy", "image", "summary", "protobuf", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary.py#L95-L145
32,132
tensorflow/tensorboard
tensorboard/backend/application.py
tensor_size_guidance_from_flags
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...
python
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", ")", ":", "tensor_size_guidance", "=", "dict", "(", "DEFAULT_TENSOR_SIZE_GUIDANCE", ")", "if", "not", "flags", "or", "not", "flags", ".", "samples_per_plugin", ":", "return", "tensor_size_guidance", "for", "token...
Apply user per-summary size guidance overrides.
[ "Apply", "user", "per", "-", "summary", "size", "guidance", "overrides", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L80-L91
32,133
tensorflow/tensorboard
tensorboard/backend/application.py
standard_tensorboard_wsgi
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...
python
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", ")", ":", "multiplexer", "=", "event_multiplexer", ".", "EventMultiplexer", "(", "size_guidance", "=", "DEFAULT_SIZE_GUIDANCE", ",", "tensor_size_guidance", "=", "tensor_s...
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...
[ "Construct", "a", "TensorBoardWSGIApp", "with", "standard", "plugins", "and", "multiplexer", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L94-L160
32,134
tensorflow/tensorboard
tensorboard/backend/application.py
TensorBoardWSGIApp
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, ...
python
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'", ")", ":", "path_to_run", "=", "parse_event_files_spec", "(", "logdir", ")", "if", "reload_in...
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...
[ "Constructs", "the", "TensorBoard", "application", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L163-L193
32,135
tensorflow/tensorboard
tensorboard/backend/application.py
parse_event_files_spec
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...
python
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", ")", ":", "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...
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...
[ "Parses", "logdir", "into", "a", "map", "from", "paths", "to", "run", "group", "names", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L317-L357
32,136
tensorflow/tensorboard
tensorboard/backend/application.py
start_reloading_multiplexer
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...
python
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", ")", ":", "if", "load_interval", "<", "0", ":", "raise", "ValueError", "(", "'load_interval is negative: %d'", "%", "load_interval", ")", "def", "...
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...
[ "Starts", "automatically", "reloading", "the", "given", "multiplexer", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L360-L417
32,137
tensorflow/tensorboard
tensorboard/backend/application.py
get_database_info
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...
python
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", ")", ":", "if", "not", "db_uri", ":", "return", "None", ",", "None", "scheme", "=", "urlparse", ".", "urlparse", "(", "db_uri", ")", ".", "scheme", "if", "scheme", "==", "'sqlite'", ":", "return", "sqlite3", ","...
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 ...
[ "Returns", "TBContext", "fields", "relating", "to", "SQL", "database", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L420-L439
32,138
tensorflow/tensorboard
tensorboard/backend/application.py
create_sqlite_connection_provider
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: ...
python
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", ")", ":", "uri", "=", "urlparse", ".", "urlparse", "(", "db_uri", ")", "if", "uri", ".", "scheme", "!=", "'sqlite'", ":", "raise", "ValueError", "(", "'Scheme is not sqlite: '", "+", "db_uri", ")", "if...
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...
[ "Returns", "function", "that", "returns", "SQLite", "Connection", "objects", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L442-L465
32,139
tensorflow/tensorboard
tensorboard/backend/application.py
TensorBoardWSGI._serve_plugins_listing
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...
python
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", ")", ":", "response", "=", "{", "}", "for", "plugin", "in", "self", ".", "_plugins", ":", "start", "=", "time", ".", "time", "(", ")", "response", "[", "plugin", ".", "plugin_name", "]", "="...
Serves an object mapping plugin name to whether it is enabled. Args: request: The werkzeug.Request object. Returns: A werkzeug.Response object.
[ "Serves", "an", "object", "mapping", "plugin", "name", "to", "whether", "it", "is", "enabled", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/application.py#L268-L285
32,140
tensorflow/tensorboard
tensorboard/plugins/debugger/tensor_helper.py
parse_time_indices
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...
python
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", ")", ":", "if", "not", "s", ".", "startswith", "(", "'['", ")", ":", "s", "=", "'['", "+", "s", "+", "']'", "parsed", "=", "command_parser", ".", "_parse_slices", "(", "s", ")", "if", "len", "(", "parsed", ")"...
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.
[ "Parse", "a", "string", "as", "time", "indices", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L43-L62
32,141
tensorflow/tensorboard
tensorboard/plugins/debugger/tensor_helper.py
process_buffers_for_display
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...
python
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", ")", ":", "if", "isinstance", "(", "s", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "process_buffers_for_display", "(", "elem", ",", "limit", "=", "limit", ")", ...
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...
[ "Process", "a", "buffer", "for", "human", "-", "readable", "display", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L83-L110
32,142
tensorflow/tensorboard
tensorboard/plugins/debugger/tensor_helper.py
array_view
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...
python
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", ")", ":", "dtype", "=", "translate_dtype", "(", "array", ".", "dtype", ")", "sliced_array", "=", "(", "array", "[", "command_parser", ".", "_parse_slices", "(", ...
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 ...
[ "View", "a", "slice", "or", "the", "entirety", "of", "an", "ndarray", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L113-L165
32,143
tensorflow/tensorboard
tensorboard/plugins/debugger/tensor_helper.py
array_to_base64_png
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....
python
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", ")", ":", "# 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", "...
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...
[ "Convert", "an", "array", "into", "base64", "-", "enoded", "PNG", "image", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/tensor_helper.py#L174-L223
32,144
tensorflow/tensorboard
tensorboard/plugins/graph/graph_util.py
_safe_copy_proto_list_values
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_...
python
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", ")", ":", "def", "_assert_proto_container_unique_keys", "(", "proto_list", ",", "get_key", ")", ":", "\"\"\"Asserts proto_list to only contains unique keys.\n\n Args:\n pr...
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...
[ "Safely", "merge", "values", "from", "src_proto_list", "into", "dst_proto_list", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graph_util.py#L27-L87
32,145
tensorflow/tensorboard
tensorboard/plugins/graph/graph_util.py
combine_graph_defs
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. ...
python
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", ")", ":", "if", "from_proto", ".", "version", "!=", "to_proto", ".", "version", ":", "raise", "ValueError", "(", "'Cannot combine GraphDefs of different versions.'", ")", "try", ":", "_safe_copy_proto_li...
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...
[ "Combines", "two", "GraphDefs", "by", "adding", "nodes", "from", "from_proto", "into", "to_proto", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/graph/graph_util.py#L90-L150
32,146
tensorflow/tensorboard
tensorboard/plugins/scalar/summary_v2.py
scalar
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...
python
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", ")", ":", "summary_metadata", "=", "metadata", ".", "create_summary_metadata", "(", "display_name", "=", "None", ",", "description", "=", "description", ")"...
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...
[ "Write", "a", "scalar", "summary", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/summary_v2.py#L32-L65
32,147
tensorflow/tensorboard
tensorboard/plugins/scalar/summary_v2.py
scalar_pb
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...
python
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", ")", ":", "arr", "=", "np", ".", "array", "(", "data", ")", "if", "arr", ".", "shape", "!=", "(", ")", ":", "raise", "ValueError", "(", "'Expected scalar shape for tensor, got ...
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...
[ "Create", "a", "scalar", "summary_pb2", ".", "Summary", "protobuf", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/summary_v2.py#L68-L96
32,148
tensorflow/tensorboard
tensorboard/plugins/profile/profile_demo.py
dump_data
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...
python
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", ")", ":", "# 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...
Dumps plugin data to the log directory.
[ "Dumps", "plugin", "data", "to", "the", "log", "directory", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_demo.py#L67-L102
32,149
tensorflow/tensorboard
tensorboard/plugins/debugger/health_pill_calc.py
calc_health_pill
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...
python
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", ")", ":", "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...
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...
[ "Calculate", "health", "pill", "of", "a", "tensor", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/health_pill_calc.py#L34-L118
32,150
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder._get_config
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...
python
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", ")", ":", "filename", "=", "'{}/{}'", ".", "format", "(", "self", ".", "PLUGIN_LOGDIR", ",", "CONFIG_FILENAME", ")", "modified_time", "=", "os", ".", "path", ".", "getmtime", "(", "filename", ")", "if", "modified_time", "...
Reads the config file from disk or creates a new one.
[ "Reads", "the", "config", "file", "from", "disk", "or", "creates", "a", "new", "one", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L70-L82
32,151
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder._write_summary
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)
python
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", ")", ":", "summary", "=", "session", ".", "run", "(", "self", ".", "summary_op", ",", "feed_dict", "=", "{", "self", ".", "frame_placeholder", ":", "frame", "}", ")", "path", "=", "'{}...
Writes the frame to disk as a tensor summary.
[ "Writes", "the", "frame", "to", "disk", "as", "a", "tensor", "summary", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L85-L91
32,152
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder._enough_time_has_passed
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
python
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", ")", ":", "if", "FPS", "==", "0", ":", "return", "False", "else", ":", "earliest_time", "=", "self", ".", "last_update_time", "+", "(", "1.0", "/", "FPS", ")", "return", "time", ".", "time", "(...
For limiting how often frames are computed.
[ "For", "limiting", "how", "often", "frames", "are", "computed", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L121-L127
32,153
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder._update_recording
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...
python
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", ")", ":", "# pylint: disable=redefined-variable-type", "should_record", "=", "config", "[", "'is_recording'", "]", "if", "should_record", ":", "if", "not", "self", ".", "is_recording", ":", "sel...
Adds a frame to the current video output.
[ "Adds", "a", "frame", "to", "the", "current", "video", "output", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L138-L153
32,154
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder.update
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...
python
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", ")", ":", "new_config", "=", "self", ".", "_get_config", "(", ")", "if", "self", ".", "_enough_time_has_passed", "(", "self", ".", "previous_config", "["...
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...
[ "Creates", "a", "frame", "and", "writes", "it", "to", "disk", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L158-L175
32,155
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
Beholder.gradient_helper
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...
python
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", ")", ":", "if", "var_list", "is", "None", ":", "var_list", "=", "tf", ".", "compat", ".", "v1", ".", "trainable_variables", "(", ")", "grads_and_vars", "=", "optimizer",...
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.
[ "A", "helper", "to", "get", "the", "gradients", "out", "at", "each", "step", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L181-L196
32,156
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_extractors
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...
python
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", ")", ":", "result", "=", "[", "]", "for", "col_param", "in", "col_params", ":", "result", ".", "append", "(", "_create_extractor", "(", "col_param", ")", ")", "return", "result" ]
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
[ "Creates", "extractors", "to", "extract", "properties", "corresponding", "to", "col_params", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L264-L277
32,157
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_metric_extractor
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...
python
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", ")", ":", "def", "extractor_fn", "(", "session_or_group", ")", ":", "metric_value", "=", "_find_metric_value", "(", "session_or_group", ",", "metric_name", ")", "return", "metric_value", ".", "value", "if", "met...
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...
[ "Returns", "function", "that", "extracts", "a", "metric", "from", "a", "session", "group", "or", "a", "session", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L291-L307
32,158
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_find_metric_value
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...
python
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", ")", ":", "# 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...
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...
[ "Returns", "the", "metric_value", "for", "a", "given", "metric", "in", "a", "session", "or", "session", "group", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L310-L327
32,159
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_hparam_extractor
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,...
python
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", ")", ":", "def", "extractor_fn", "(", "session_group", ")", ":", "if", "hparam_name", "in", "session_group", ".", "hparams", ":", "return", "_value_to_python", "(", "session_group", ".", "hparams", "[", "hpara...
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...
[ "Returns", "an", "extractor", "function", "that", "extracts", "an", "hparam", "from", "a", "session", "group", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L330-L345
32,160
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_filters
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...
python
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", ")", ":", "result", "=", "[", "]", "for", "col_param", ",", "extractor", "in", "zip", "(", "col_params", ",", "extractors", ")", ":", "a_filter", "=", "_create_filter", "(", "col_param", ",", ...
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 ...
[ "Creates", "filters", "for", "the", "given", "col_params", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L352-L369
32,161
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_filter
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...
python
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", ")", ":", "include_missing_values", "=", "not", "col_param", ".", "exclude_missing_values", "if", "col_param", ".", "HasField", "(", "'filter_regexp'", ")", ":", "value_filter_fn", "=", "_create_regexp_filte...
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...
[ "Creates", "a", "filter", "for", "the", "given", "col_param", "and", "extractor", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L372-L407
32,162
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_regexp_filter
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...
python
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", ")", ":", "# 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...
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.
[ "Returns", "a", "boolean", "function", "that", "filters", "strings", "based", "on", "a", "regular", "exp", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L410-L431
32,163
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_create_interval_filter
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...
python
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", ")", ":", "def", "filter_fn", "(", "value", ")", ":", "if", "(", "not", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "and", "not", "isinstance", "(", "value", ",", "float", ")", ")"...
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) ...
[ "Returns", "a", "function", "that", "checkes", "whether", "a", "number", "belongs", "to", "an", "interval", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L434-L452
32,164
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_value_to_python
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...
python
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", ")", ":", "assert", "isinstance", "(", "value", ",", "struct_pb2", ".", "Value", ")", "field", "=", "value", ".", "WhichOneof", "(", "'kind'", ")", "if", "field", "==", "'number_value'", ":", "return", "value", ".",...
Converts a google.protobuf.Value to a native Python object.
[ "Converts", "a", "google", ".", "protobuf", ".", "Value", "to", "a", "native", "Python", "object", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L471-L483
32,165
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_set_avg_session_metrics
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...
python
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", ")", ":", "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...
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...
[ "Sets", "the", "metrics", "for", "the", "group", "to", "be", "the", "average", "of", "its", "sessions", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L524-L558
32,166
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_set_median_session_metrics
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...
python
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", ")", ":", "measurements", "=", "sorted", "(", "_measurements", "(", "session_group", ",", "aggregation_metric", ")", ",", "key", "=", "operator", ".", "attrgetter", "(", "'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 the group whose 'aggregation_metric' was measured at the largest training...
[ "Sets", "the", "metrics", "for", "session_group", "to", "those", "of", "its", "median", "session", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L567-L584
32,167
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_set_extremum_session_metrics
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'. ...
python
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", ")", ":", "measurements", "=", "_measurements", "(", "session_group", ",", "aggregation_metric", ")", "ext_session", "=", "extremum_fn", "(", "measurements", ","...
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 ...
[ "Sets", "the", "metrics", "for", "session_group", "to", "those", "of", "its", "extremum", "session", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L587-L608
32,168
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
_measurements
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...
python
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", ")", ":", "for", "session_index", ",", "session", "in", "enumerate", "(", "session_group", ".", "sessions", ")", ":", "metric_value", "=", "_find_metric_value", "(", "session", ",", "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.
[ "A", "generator", "for", "the", "values", "of", "the", "metric", "across", "the", "sessions", "in", "the", "group", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L611-L624
32,169
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session_groups
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...
python
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", ")", ":", "# 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...
Returns a list of SessionGroups protobuffers from the summary data.
[ "Returns", "a", "list", "of", "SessionGroups", "protobuffers", "from", "the", "summary", "data", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L65-L96
32,170
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._add_session
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...
python
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", ")", ":", "# 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", "=...
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...
[ "Adds", "a", "new", "Session", "protobuffer", "to", "the", "groups_by_name", "dictionary", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L98-L130
32,171
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session
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...
python
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", ")", ":", "assert", "start_info", "is", "not", "None", "result", "=", "api_pb2", ".", "Session", "(", "name", "=", "name", ",", "start_time_secs", "=", "start_info", "."...
Builds a session object.
[ "Builds", "a", "session", "object", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L132-L145
32,172
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._build_session_metric_values
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...
python
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", ")", ":", "# result is a list of api_pb2.MetricValue instances.", "result", "=", "[", "]", "metric_infos", "=", "self", ".", "_experiment", ".", "metric_infos", "for", "metric_info", "in", "metric_...
Builds the session metric values.
[ "Builds", "the", "session", "metric", "values", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L147-L170
32,173
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._aggregate_metrics
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...
python
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", ")", ":", "if", "(", "self", ".", "_request", ".", "aggregation_type", "==", "api_pb2", ".", "AGGREGATION_AVG", "or", "self", ".", "_request", ".", "aggregation_type", "==", "api_pb2", ".", "AGGRE...
Sets the metrics of the group based on aggregation_type.
[ "Sets", "the", "metrics", "of", "the", "group", "based", "on", "aggregation_type", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L172-L191
32,174
tensorflow/tensorboard
tensorboard/plugins/hparams/list_session_groups.py
Handler._sort
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...
python
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", ")", ":", "# Sort by session_group name so we have a deterministic order.", "session_groups", ".", "sort", "(", "key", "=", "operator", ".", "attrgetter", "(", "'name'", ")", ")", "# Sort by lexicographical order of the ...
Sorts 'session_groups' in place according to _request.col_params.
[ "Sorts", "session_groups", "in", "place", "according", "to", "_request", ".", "col_params", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/list_session_groups.py#L199-L226
32,175
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioBasicIO.py
readAudioFile
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 ...
python
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", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "path", ")", "[", "1", "]", "try", ":", "#if extension.lower() == '.wav':", "#[Fs, x] = wavfile.read(path)", "if", "extension", ".", "lower", "(", ")", ...
This function returns a numpy array that stores the audio samples of a specified WAV of AIFF file
[ "This", "function", "returns", "a", "numpy", "array", "that", "stores", "the", "audio", "samples", "of", "a", "specified", "WAV", "of", "AIFF", "file" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioBasicIO.py#L66-L112
32,176
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
computePreRec
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...
python
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", ")", ":", "n_classes", "=", "cm", ".", "shape", "[", "0", "]", "if", "len", "(", "class_names", ")", "!=", "n_classes", ":", "print", "(", "\"Error in computePreRec! Confusion matrix and class_names \"", "\"...
This function computes the precision, recall and f1 measures, given a confusion matrix
[ "This", "function", "computes", "the", "precision", "recall", "and", "f1", "measures", "given", "a", "confusion", "matrix" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L124-L141
32,177
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioSegmentation.py
trainHMM_computeStatistics
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...
python
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", ")", ":", "u_labels", "=", "numpy", ".", "unique", "(", "labels", ")", "n_comps", "=", "len", "(", "u_labels", ")", "n_feats", "=", "features", ".", "shape", "[", "0", "]", "if", "featu...
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...
[ "This", "function", "computes", "the", "statistics", "used", "to", "train", "an", "HMM", "joint", "segmentation", "-", "classification", "model", "using", "a", "sequence", "of", "sequential", "features", "and", "respective", "labels" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioSegmentation.py#L278-L330
32,178
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
levenshtein
def levenshtein(str1, s2): ''' Distance between two strings ''' N1 = len(str1) N2 = len(s2) stringRange = [range(N1 + 1)] * (N2 + 1) for i in range(N2 + 1): stringRange[i] = range(i,i + N1 + 1) for i in range(0,N2): for j in range(0,N1): if str1[j] == s2[i]: ...
python
def levenshtein(str1, s2): ''' Distance between two strings ''' N1 = len(str1) N2 = len(s2) stringRange = [range(N1 + 1)] * (N2 + 1) for i in range(N2 + 1): stringRange[i] = range(i,i + N1 + 1) for i in range(0,N2): for j in range(0,N1): if str1[j] == s2[i]: ...
[ "def", "levenshtein", "(", "str1", ",", "s2", ")", ":", "N1", "=", "len", "(", "str1", ")", "N2", "=", "len", "(", "s2", ")", "stringRange", "=", "[", "range", "(", "N1", "+", "1", ")", "]", "*", "(", "N2", "+", "1", ")", "for", "i", "in", ...
Distance between two strings
[ "Distance", "between", "two", "strings" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L32-L52
32,179
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioVisualization.py
chordialDiagram
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
python
def chordialDiagram(fileStr, SM, Threshold, names, namesCategories): ''' Generates a d3js chordial diagram that illustrates similarites ''' colors = text_list_to_colors_simple(namesCategories) SM2 = SM.copy() SM2 = (SM2 + SM2.T) / 2.0 for i in range(SM2.shape[0]): M = Threshold # ...
[ "def", "chordialDiagram", "(", "fileStr", ",", "SM", ",", "Threshold", ",", "names", ",", "namesCategories", ")", ":", "colors", "=", "text_list_to_colors_simple", "(", "namesCategories", ")", "SM2", "=", "SM", ".", "copy", "(", ")", "SM2", "=", "(", "SM2"...
Generates a d3js chordial diagram that illustrates similarites
[ "Generates", "a", "d3js", "chordial", "diagram", "that", "illustrates", "similarites" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioVisualization.py#L92-L123
32,180
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stZCR
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
python
def stZCR(frame): """Computes zero crossing rate of frame""" count = len(frame) countZ = numpy.sum(numpy.abs(numpy.diff(numpy.sign(frame)))) / 2 return (numpy.float64(countZ) / numpy.float64(count-1.0))
[ "def", "stZCR", "(", "frame", ")", ":", "count", "=", "len", "(", "frame", ")", "countZ", "=", "numpy", ".", "sum", "(", "numpy", ".", "abs", "(", "numpy", ".", "diff", "(", "numpy", ".", "sign", "(", "frame", ")", ")", ")", ")", "/", "2", "r...
Computes zero crossing rate of frame
[ "Computes", "zero", "crossing", "rate", "of", "frame" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L19-L23
32,181
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stHarmonic
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
python
def stHarmonic(frame, fs): """ Computes harmonic ratio and pitch """ M = numpy.round(0.016 * fs) - 1 R = numpy.correlate(frame, frame, mode='full') g = R[len(frame)-1] R = R[len(frame):-1] # estimate m0 (as the first zero crossing of R) [a, ] = numpy.nonzero(numpy.diff(numpy.sign(R...
[ "def", "stHarmonic", "(", "frame", ",", "fs", ")", ":", "M", "=", "numpy", ".", "round", "(", "0.016", "*", "fs", ")", "-", "1", "R", "=", "numpy", ".", "correlate", "(", "frame", ",", "frame", ",", "mode", "=", "'full'", ")", "g", "=", "R", ...
Computes harmonic ratio and pitch
[ "Computes", "harmonic", "ratio", "and", "pitch" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L121-L166
32,182
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stMFCC
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
python
def stMFCC(X, fbank, n_mfcc_feats): """ Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken fr...
[ "def", "stMFCC", "(", "X", ",", "fbank", ",", "n_mfcc_feats", ")", ":", "mspec", "=", "numpy", ".", "log10", "(", "numpy", ".", "dot", "(", "X", ",", "fbank", ".", "T", ")", "+", "eps", ")", "ceps", "=", "dct", "(", "mspec", ",", "type", "=", ...
Computes the MFCCs of a frame, given the fft mag ARGUMENTS: X: fft magnitude abs(FFT) fbank: filter bank (see mfccInitFilterBanks) RETURN ceps: MFCCs (13 element vector) Note: MFCC calculation is, in general, taken from the scikits.talkbox library (MI...
[ "Computes", "the", "MFCCs", "of", "a", "frame", "given", "the", "fft", "mag" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L219-L237
32,183
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stChromaFeaturesInit
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
python
def stChromaFeaturesInit(nfft, fs): """ This function initializes the chroma matrices used in the calculation of the chroma features """ freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) ...
[ "def", "stChromaFeaturesInit", "(", "nfft", ",", "fs", ")", ":", "freqs", "=", "numpy", ".", "array", "(", "[", "(", "(", "f", "+", "1", ")", "*", "fs", ")", "/", "(", "2", "*", "nfft", ")", "for", "f", "in", "range", "(", "nfft", ")", "]", ...
This function initializes the chroma matrices used in the calculation of the chroma features
[ "This", "function", "initializes", "the", "chroma", "matrices", "used", "in", "the", "calculation", "of", "the", "chroma", "features" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L240-L255
32,184
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
stFeatureExtraction
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
python
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
[ "def", "stFeatureExtraction", "(", "signal", ",", "fs", ",", "win", ",", "step", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "# Signal normalization", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples fs: the sampling freq (in Hz) win: ...
[ "This", "function", "implements", "the", "shor", "-", "term", "windowing", "process", ".", "For", "each", "short", "-", "term", "window", "a", "set", "of", "features", "is", "extracted", ".", "This", "results", "to", "a", "sequence", "of", "feature", "vect...
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L521-L614
32,185
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
mtFeatureExtraction
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
python
def mtFeatureExtraction(signal, fs, mt_win, mt_step, st_win, st_step): """ Mid-term feature extraction """ mt_win_ratio = int(round(mt_win / st_step)) mt_step_ratio = int(round(mt_step / st_step)) mt_features = [] st_features, f_names = stFeatureExtraction(signal, fs, st_win, st_step) ...
[ "def", "mtFeatureExtraction", "(", "signal", ",", "fs", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "mt_win_ratio", "=", "int", "(", "round", "(", "mt_win", "/", "st_step", ")", ")", "mt_step_ratio", "=", "int", "(", "round", ...
Mid-term feature extraction
[ "Mid", "-", "term", "feature", "extraction" ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L617-L654
32,186
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtraction
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
python
def dirWavFeatureExtraction(dirName, mt_win, mt_step, st_win, st_step, compute_beat=False): """ This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Ther...
[ "def", "dirWavFeatureExtraction", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ",", "compute_beat", "=", "False", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "process_times", "=", "[", "]", "...
This function extracts the mid-term features of the WAVE files of a particular folder. The resulting feature vector is extracted by long-term averaging the mid-term features. Therefore ONE FEATURE VECTOR is extracted for each WAV file. ARGUMENTS: - dirName: the path of the WAVE directory ...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L726-L799
32,187
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
dirWavFeatureExtractionNoAveraging
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
python
def dirWavFeatureExtractionNoAveraging(dirName, mt_win, mt_step, st_win, st_step): """ This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: m...
[ "def", "dirWavFeatureExtractionNoAveraging", "(", "dirName", ",", "mt_win", ",", "mt_step", ",", "st_win", ",", "st_step", ")", ":", "all_mt_feats", "=", "numpy", ".", "array", "(", "[", "]", ")", "signal_idx", "=", "numpy", ".", "array", "(", "[", "]", ...
This function extracts the mid-term features of the WAVE files of a particular folder without averaging each file. ARGUMENTS: - dirName: the path of the WAVE directory - mt_win, mt_step: mid-term window and step (in seconds) - st_win, st_step: short-term window and step (...
[ "This", "function", "extracts", "the", "mid", "-", "term", "features", "of", "the", "WAVE", "files", "of", "a", "particular", "folder", "without", "averaging", "each", "file", "." ]
e3da991e7247492deba50648a4c7c0f41e684af4
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L834-L879
32,188
ricequant/rqalpha
rqalpha/__main__.py
update_bundle
def update_bundle(data_bundle_path, locale): """ Sync Data Bundle """ import rqalpha.utils.bundle_helper rqalpha.utils.bundle_helper.update_bundle(data_bundle_path, locale)
python
def update_bundle(data_bundle_path, locale): """ Sync Data Bundle """ import rqalpha.utils.bundle_helper rqalpha.utils.bundle_helper.update_bundle(data_bundle_path, locale)
[ "def", "update_bundle", "(", "data_bundle_path", ",", "locale", ")", ":", "import", "rqalpha", ".", "utils", ".", "bundle_helper", "rqalpha", ".", "utils", ".", "bundle_helper", ".", "update_bundle", "(", "data_bundle_path", ",", "locale", ")" ]
Sync Data Bundle
[ "Sync", "Data", "Bundle" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L77-L82
32,189
ricequant/rqalpha
rqalpha/__main__.py
run
def run(**kwargs): """ Start to run a strategy """ config_path = kwargs.get('config_path', None) if config_path is not None: config_path = os.path.abspath(config_path) kwargs.pop('config_path') if not kwargs.get('base__securities', None): kwargs.pop('base__securities', No...
python
def run(**kwargs): """ Start to run a strategy """ config_path = kwargs.get('config_path', None) if config_path is not None: config_path = os.path.abspath(config_path) kwargs.pop('config_path') if not kwargs.get('base__securities', None): kwargs.pop('base__securities', No...
[ "def", "run", "(", "*", "*", "kwargs", ")", ":", "config_path", "=", "kwargs", ".", "get", "(", "'config_path'", ",", "None", ")", "if", "config_path", "is", "not", "None", ":", "config_path", "=", "os", ".", "path", ".", "abspath", "(", "config_path",...
Start to run a strategy
[ "Start", "to", "run", "a", "strategy" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L112-L140
32,190
ricequant/rqalpha
rqalpha/__main__.py
examples
def examples(directory): """ Generate example strategies to target folder """ source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "examples") try: shutil.copytree(source_dir, os.path.join(directory, "examples")) except OSError as e: if e.errno == errno.EEXIST:...
python
def examples(directory): """ Generate example strategies to target folder """ source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "examples") try: shutil.copytree(source_dir, os.path.join(directory, "examples")) except OSError as e: if e.errno == errno.EEXIST:...
[ "def", "examples", "(", "directory", ")", ":", "source_dir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "\"examples\"", ")", "try", ":", "shu...
Generate example strategies to target folder
[ "Generate", "example", "strategies", "to", "target", "folder" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L145-L155
32,191
ricequant/rqalpha
rqalpha/__main__.py
generate_config
def generate_config(directory): """ Generate default config file """ default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml") target_config_path = os.path.abspath(os.path.join(directory, 'config.yml')) shutil.copy(default_config, target_config_path) six.print_...
python
def generate_config(directory): """ Generate default config file """ default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml") target_config_path = os.path.abspath(os.path.join(directory, 'config.yml')) shutil.copy(default_config, target_config_path) six.print_...
[ "def", "generate_config", "(", "directory", ")", ":", "default_config", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "realpath", "(", "__file__", ")", ")", ",", "\"config.yml\"", ")", "target...
Generate default config file
[ "Generate", "default", "config", "file" ]
ac40a62d4e7eca9494b4d0a14f46facf5616820c
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/__main__.py#L170-L177
32,192
elastic/elasticsearch-py
elasticsearch/transport.py
Transport.perform_request
def perform_request(self, method, url, headers=None, params=None, body=None): """ Perform the actual request. Retrieve a connection from the connection pool, pass all the information to it's perform_request method and return the data. If an exception was raised, mark the connect...
python
def perform_request(self, method, url, headers=None, params=None, body=None): """ Perform the actual request. Retrieve a connection from the connection pool, pass all the information to it's perform_request method and return the data. If an exception was raised, mark the connect...
[ "def", "perform_request", "(", "self", ",", "method", ",", "url", ",", "headers", "=", "None", ",", "params", "=", "None", ",", "body", "=", "None", ")", ":", "if", "body", "is", "not", "None", ":", "body", "=", "self", ".", "serializer", ".", "dum...
Perform the actual request. Retrieve a connection from the connection pool, pass all the information to it's perform_request method and return the data. If an exception was raised, mark the connection as failed and retry (up to `max_retries` times). If the operation was succesf...
[ "Perform", "the", "actual", "request", ".", "Retrieve", "a", "connection", "from", "the", "connection", "pool", "pass", "all", "the", "information", "to", "it", "s", "perform_request", "method", "and", "return", "the", "data", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/transport.py#L258-L350
32,193
elastic/elasticsearch-py
example/load.py
parse_commits
def parse_commits(head, name): """ Go through the git repository log and generate a document per commit containing all the metadata. """ for commit in head.traverse(): yield { '_id': commit.hexsha, 'repository': name, 'committed_date': datetime.fromtimesta...
python
def parse_commits(head, name): """ Go through the git repository log and generate a document per commit containing all the metadata. """ for commit in head.traverse(): yield { '_id': commit.hexsha, 'repository': name, 'committed_date': datetime.fromtimesta...
[ "def", "parse_commits", "(", "head", ",", "name", ")", ":", "for", "commit", "in", "head", ".", "traverse", "(", ")", ":", "yield", "{", "'_id'", ":", "commit", ".", "hexsha", ",", "'repository'", ":", "name", ",", "'committed_date'", ":", "datetime", ...
Go through the git repository log and generate a document per commit containing all the metadata.
[ "Go", "through", "the", "git", "repository", "log", "and", "generate", "a", "document", "per", "commit", "containing", "all", "the", "metadata", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/example/load.py#L76-L100
32,194
elastic/elasticsearch-py
example/load.py
load_repo
def load_repo(client, path=None, index='git'): """ Parse a git repository with all it's commits and load it into elasticsearch using `client`. If the index doesn't exist it will be created. """ path = dirname(dirname(abspath(__file__))) if path is None else path repo_name = basename(path) re...
python
def load_repo(client, path=None, index='git'): """ Parse a git repository with all it's commits and load it into elasticsearch using `client`. If the index doesn't exist it will be created. """ path = dirname(dirname(abspath(__file__))) if path is None else path repo_name = basename(path) re...
[ "def", "load_repo", "(", "client", ",", "path", "=", "None", ",", "index", "=", "'git'", ")", ":", "path", "=", "dirname", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ")", "if", "path", "is", "None", "else", "path", "repo_name", "=", ...
Parse a git repository with all it's commits and load it into elasticsearch using `client`. If the index doesn't exist it will be created.
[ "Parse", "a", "git", "repository", "with", "all", "it", "s", "commits", "and", "load", "it", "into", "elasticsearch", "using", "client", ".", "If", "the", "index", "doesn", "t", "exist", "it", "will", "be", "created", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/example/load.py#L102-L130
32,195
elastic/elasticsearch-py
elasticsearch/helpers/actions.py
parallel_bulk
def parallel_bulk( client, actions, thread_count=4, chunk_size=500, max_chunk_bytes=100 * 1024 * 1024, queue_size=4, expand_action_callback=expand_action, *args, **kwargs ): """ Parallel version of the bulk helper run in multiple threads at once. :arg client: instance of...
python
def parallel_bulk( client, actions, thread_count=4, chunk_size=500, max_chunk_bytes=100 * 1024 * 1024, queue_size=4, expand_action_callback=expand_action, *args, **kwargs ): """ Parallel version of the bulk helper run in multiple threads at once. :arg client: instance of...
[ "def", "parallel_bulk", "(", "client", ",", "actions", ",", "thread_count", "=", "4", ",", "chunk_size", "=", "500", ",", "max_chunk_bytes", "=", "100", "*", "1024", "*", "1024", ",", "queue_size", "=", "4", ",", "expand_action_callback", "=", "expand_action...
Parallel version of the bulk helper run in multiple threads at once. :arg client: instance of :class:`~elasticsearch.Elasticsearch` to use :arg actions: iterator containing the actions :arg thread_count: size of the threadpool to use for the bulk requests :arg chunk_size: number of docs in one chunk se...
[ "Parallel", "version", "of", "the", "bulk", "helper", "run", "in", "multiple", "threads", "at", "once", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/helpers/actions.py#L312-L373
32,196
elastic/elasticsearch-py
elasticsearch/client/indices.py
IndicesClient.forcemerge
def forcemerge(self, index=None, params=None): """ The force merge API allows to force merging of one or more indices through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segme...
python
def forcemerge(self, index=None, params=None): """ The force merge API allows to force merging of one or more indices through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segme...
[ "def", "forcemerge", "(", "self", ",", "index", "=", "None", ",", "params", "=", "None", ")", ":", "return", "self", ".", "transport", ".", "perform_request", "(", "\"POST\"", ",", "_make_path", "(", "index", ",", "\"_forcemerge\"", ")", ",", "params", "...
The force merge API allows to force merging of one or more indices through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by merging them. This call will block until the merge ...
[ "The", "force", "merge", "API", "allows", "to", "force", "merging", "of", "one", "or", "more", "indices", "through", "an", "API", ".", "The", "merge", "relates", "to", "the", "number", "of", "segments", "a", "Lucene", "index", "holds", "within", "each", ...
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/indices.py#L953-L985
32,197
elastic/elasticsearch-py
elasticsearch/client/indices.py
IndicesClient.rollover
def rollover(self, alias, new_index=None, body=None, params=None): """ The rollover index API rolls an alias over to a new index when the existing index is considered to be too large or too old. The API accepts a single alias name and a list of conditions. The alias must point t...
python
def rollover(self, alias, new_index=None, body=None, params=None): """ The rollover index API rolls an alias over to a new index when the existing index is considered to be too large or too old. The API accepts a single alias name and a list of conditions. The alias must point t...
[ "def", "rollover", "(", "self", ",", "alias", ",", "new_index", "=", "None", ",", "body", "=", "None", ",", "params", "=", "None", ")", ":", "if", "alias", "in", "SKIP_IN_PATH", ":", "raise", "ValueError", "(", "\"Empty value passed for a required argument 'al...
The rollover index API rolls an alias over to a new index when the existing index is considered to be too large or too old. The API accepts a single alias name and a list of conditions. The alias must point to a single index only. If the index satisfies the specified conditions then a n...
[ "The", "rollover", "index", "API", "rolls", "an", "alias", "over", "to", "a", "new", "index", "when", "the", "existing", "index", "is", "considered", "to", "be", "too", "large", "or", "too", "old", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/indices.py#L1024-L1052
32,198
elastic/elasticsearch-py
elasticsearch/client/utils.py
_escape
def _escape(value): """ Escape a single value of a URL string or a query parameter. If it is a list or tuple, turn it into a comma-separated string first. """ # make sequences into comma-separated stings if isinstance(value, (list, tuple)): value = ",".join(value) # dates and datet...
python
def _escape(value): """ Escape a single value of a URL string or a query parameter. If it is a list or tuple, turn it into a comma-separated string first. """ # make sequences into comma-separated stings if isinstance(value, (list, tuple)): value = ",".join(value) # dates and datet...
[ "def", "_escape", "(", "value", ")", ":", "# make sequences into comma-separated stings", "if", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ")", ")", ":", "value", "=", "\",\"", ".", "join", "(", "value", ")", "# dates and datetimes into isoforma...
Escape a single value of a URL string or a query parameter. If it is a list or tuple, turn it into a comma-separated string first.
[ "Escape", "a", "single", "value", "of", "a", "URL", "string", "or", "a", "query", "parameter", ".", "If", "it", "is", "a", "list", "or", "tuple", "turn", "it", "into", "a", "comma", "-", "separated", "string", "first", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/utils.py#L12-L41
32,199
elastic/elasticsearch-py
elasticsearch/client/utils.py
_make_path
def _make_path(*parts): """ Create a URL string from parts, omit all `None` values and empty strings. Convert lists and tuples to comma separated values. """ # TODO: maybe only allow some parts to be lists/tuples ? return "/" + "/".join( # preserve ',' and '*' in url for nicer URLs in lo...
python
def _make_path(*parts): """ Create a URL string from parts, omit all `None` values and empty strings. Convert lists and tuples to comma separated values. """ # TODO: maybe only allow some parts to be lists/tuples ? return "/" + "/".join( # preserve ',' and '*' in url for nicer URLs in lo...
[ "def", "_make_path", "(", "*", "parts", ")", ":", "# TODO: maybe only allow some parts to be lists/tuples ?", "return", "\"/\"", "+", "\"/\"", ".", "join", "(", "# preserve ',' and '*' in url for nicer URLs in logs", "quote_plus", "(", "_escape", "(", "p", ")", ",", "b\...
Create a URL string from parts, omit all `None` values and empty strings. Convert lists and tuples to comma separated values.
[ "Create", "a", "URL", "string", "from", "parts", "omit", "all", "None", "values", "and", "empty", "strings", ".", "Convert", "lists", "and", "tuples", "to", "comma", "separated", "values", "." ]
2aab285c8f506f3863cbdaba3c90a685c510ba00
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/utils.py#L44-L55