partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
list_registered_stateful_ops_without_inputs
Returns set of registered stateful ops that do not expect inputs. This list is used to identify the ops to be included in the state-graph and that are subsequently fed into the apply-graphs. Returns: A set of strings.
tensorflow_hub/native_module.py
def list_registered_stateful_ops_without_inputs(): """Returns set of registered stateful ops that do not expect inputs. This list is used to identify the ops to be included in the state-graph and that are subsequently fed into the apply-graphs. Returns: A set of strings. """ return set([ name ...
def list_registered_stateful_ops_without_inputs(): """Returns set of registered stateful ops that do not expect inputs. This list is used to identify the ops to be included in the state-graph and that are subsequently fed into the apply-graphs. Returns: A set of strings. """ return set([ name ...
[ "Returns", "set", "of", "registered", "stateful", "ops", "that", "do", "not", "expect", "inputs", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L586-L599
[ "def", "list_registered_stateful_ops_without_inputs", "(", ")", ":", "return", "set", "(", "[", "name", "for", "name", ",", "op", "in", "op_def_registry", ".", "get_registered_ops", "(", ")", ".", "items", "(", ")", "if", "op", ".", "is_stateful", "and", "no...
09f45963f6787322967b6fec61459f3ac56fbb27
train
get_state_map
Returns a map from tensor names to tensors that hold the state.
tensorflow_hub/native_module.py
def get_state_map(meta_graph, state_ops, unsupported_state_ops, get_tensor_by_name): """Returns a map from tensor names to tensors that hold the state.""" state_map = {} for node in meta_graph.graph_def.node: if node.op in state_ops: tensor_name = node.name + ":0" tensor = get_te...
def get_state_map(meta_graph, state_ops, unsupported_state_ops, get_tensor_by_name): """Returns a map from tensor names to tensors that hold the state.""" state_map = {} for node in meta_graph.graph_def.node: if node.op in state_ops: tensor_name = node.name + ":0" tensor = get_te...
[ "Returns", "a", "map", "from", "tensor", "names", "to", "tensors", "that", "hold", "the", "state", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L602-L617
[ "def", "get_state_map", "(", "meta_graph", ",", "state_ops", ",", "unsupported_state_ops", ",", "get_tensor_by_name", ")", ":", "state_map", "=", "{", "}", "for", "node", "in", "meta_graph", ".", "graph_def", ".", "node", ":", "if", "node", ".", "op", "in", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
replace_apply_state
Replaces state ops with non state Placeholder ops for the apply graph.
tensorflow_hub/native_module.py
def replace_apply_state(meta_graph, state_ops, feed_map): """Replaces state ops with non state Placeholder ops for the apply graph.""" for node in meta_graph.graph_def.node: keys_to_purge = [] tensor_name = node.name + ":0" # Verify that the node is a state op and that its due to be rewired # in the...
def replace_apply_state(meta_graph, state_ops, feed_map): """Replaces state ops with non state Placeholder ops for the apply graph.""" for node in meta_graph.graph_def.node: keys_to_purge = [] tensor_name = node.name + ":0" # Verify that the node is a state op and that its due to be rewired # in the...
[ "Replaces", "state", "ops", "with", "non", "state", "Placeholder", "ops", "for", "the", "apply", "graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L620-L636
[ "def", "replace_apply_state", "(", "meta_graph", ",", "state_ops", ",", "feed_map", ")", ":", "for", "node", "in", "meta_graph", ".", "graph_def", ".", "node", ":", "keys_to_purge", "=", "[", "]", "tensor_name", "=", "node", ".", "name", "+", "\":0\"", "# ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_split_tensor_name
Given a tensor name as node_name:output_number, returns both parts.
tensorflow_hub/native_module.py
def _split_tensor_name(tensor_name): """Given a tensor name as node_name:output_number, returns both parts.""" result = re.match(r"(.*):(\d+)$", tensor_name) if not result: raise ValueError( "Unexpected format for tensor name. Expected node_name:output_number. " "Got %r" % tensor_name) retur...
def _split_tensor_name(tensor_name): """Given a tensor name as node_name:output_number, returns both parts.""" result = re.match(r"(.*):(\d+)$", tensor_name) if not result: raise ValueError( "Unexpected format for tensor name. Expected node_name:output_number. " "Got %r" % tensor_name) retur...
[ "Given", "a", "tensor", "name", "as", "node_name", ":", "output_number", "returns", "both", "parts", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L654-L661
[ "def", "_split_tensor_name", "(", "tensor_name", ")", ":", "result", "=", "re", ".", "match", "(", "r\"(.*):(\\d+)$\"", ",", "tensor_name", ")", "if", "not", "result", ":", "raise", "ValueError", "(", "\"Unexpected format for tensor name. Expected node_name:output_numbe...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_extract_variable_parts
Matches a variable to individual parts. Args: variable_key: String identifier of the variable in the module scope. variable: Variable tensor. Returns: partitioned: Whether the variable is partitioned. name: Name of the variable up to the partitioning. offset: Offset of the variable into the fu...
tensorflow_hub/native_module.py
def _extract_variable_parts(variable_key, variable): """Matches a variable to individual parts. Args: variable_key: String identifier of the variable in the module scope. variable: Variable tensor. Returns: partitioned: Whether the variable is partitioned. name: Name of the variable up to the pa...
def _extract_variable_parts(variable_key, variable): """Matches a variable to individual parts. Args: variable_key: String identifier of the variable in the module scope. variable: Variable tensor. Returns: partitioned: Whether the variable is partitioned. name: Name of the variable up to the pa...
[ "Matches", "a", "variable", "to", "individual", "parts", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L664-L688
[ "def", "_extract_variable_parts", "(", "variable_key", ",", "variable", ")", ":", "name", ",", "offset", ",", "partitioned", "=", "None", ",", "None", ",", "False", "# pylint: disable=protected-access", "if", "variable", ".", "_save_slice_info", ":", "name", "=", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
recover_partitioned_variable_map
Builds a proper variable map if it contains PartitionedVariables. Args: var_node_map: A map to tf.Variables. PartitionedVariables show up in this map as N entries with keys "<var_name>/part_n". Returns: A map to tf.Variables or to list of tf.Variables for each PartitionedVariables in `var_node_m...
tensorflow_hub/native_module.py
def recover_partitioned_variable_map(var_node_map): """Builds a proper variable map if it contains PartitionedVariables. Args: var_node_map: A map to tf.Variables. PartitionedVariables show up in this map as N entries with keys "<var_name>/part_n". Returns: A map to tf.Variables or to list of tf.V...
def recover_partitioned_variable_map(var_node_map): """Builds a proper variable map if it contains PartitionedVariables. Args: var_node_map: A map to tf.Variables. PartitionedVariables show up in this map as N entries with keys "<var_name>/part_n". Returns: A map to tf.Variables or to list of tf.V...
[ "Builds", "a", "proper", "variable", "map", "if", "it", "contains", "PartitionedVariables", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L691-L745
[ "def", "recover_partitioned_variable_map", "(", "var_node_map", ")", ":", "offset_variables_map", "=", "{", "}", "for", "var_key", ",", "var_tensor", "in", "var_node_map", ".", "items", "(", ")", ":", "match", ",", "var_name", ",", "offset", "=", "_extract_varia...
09f45963f6787322967b6fec61459f3ac56fbb27
train
check_unique_tags
Checks that tag list contains each set of tags only once.
tensorflow_hub/native_module.py
def check_unique_tags(tag_list): """Checks that tag list contains each set of tags only once.""" frozen_tags_seen = set() for tags in tag_list: frozen_tags = frozenset(tags) if frozen_tags in frozen_tags_seen: raise ValueError("Tags %r used repeatedly" % tags) frozen_tags_seen.add(frozen_tags)
def check_unique_tags(tag_list): """Checks that tag list contains each set of tags only once.""" frozen_tags_seen = set() for tags in tag_list: frozen_tags = frozenset(tags) if frozen_tags in frozen_tags_seen: raise ValueError("Tags %r used repeatedly" % tags) frozen_tags_seen.add(frozen_tags)
[ "Checks", "that", "tag", "list", "contains", "each", "set", "of", "tags", "only", "once", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L748-L755
[ "def", "check_unique_tags", "(", "tag_list", ")", ":", "frozen_tags_seen", "=", "set", "(", ")", "for", "tags", "in", "tag_list", ":", "frozen_tags", "=", "frozenset", "(", "tags", ")", "if", "frozen_tags", "in", "frozen_tags_seen", ":", "raise", "ValueError",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
check_collections_are_supported
Checks that SavedModelHandler only uses supported collections.
tensorflow_hub/native_module.py
def check_collections_are_supported(saved_model_handler, supported): """Checks that SavedModelHandler only uses supported collections.""" for meta_graph in saved_model_handler.meta_graphs: used_collection_keys = set(meta_graph.collection_def.keys()) unsupported = used_collection_keys - supported if unsu...
def check_collections_are_supported(saved_model_handler, supported): """Checks that SavedModelHandler only uses supported collections.""" for meta_graph in saved_model_handler.meta_graphs: used_collection_keys = set(meta_graph.collection_def.keys()) unsupported = used_collection_keys - supported if unsu...
[ "Checks", "that", "SavedModelHandler", "only", "uses", "supported", "collections", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L758-L766
[ "def", "check_collections_are_supported", "(", "saved_model_handler", ",", "supported", ")", ":", "for", "meta_graph", "in", "saved_model_handler", ".", "meta_graphs", ":", "used_collection_keys", "=", "set", "(", "meta_graph", ".", "collection_def", ".", "keys", "(",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
register_ops_if_needed
Register graph ops absent in op_def_registry, if present in c++ registry. Args: graph_ops: set with graph op names to register. Raises: RuntimeError: if `graph_ops` contains ops that are not in either python or c++ registry.
tensorflow_hub/native_module.py
def register_ops_if_needed(graph_ops): """Register graph ops absent in op_def_registry, if present in c++ registry. Args: graph_ops: set with graph op names to register. Raises: RuntimeError: if `graph_ops` contains ops that are not in either python or c++ registry. """ missing_ops = graph_ops...
def register_ops_if_needed(graph_ops): """Register graph ops absent in op_def_registry, if present in c++ registry. Args: graph_ops: set with graph op names to register. Raises: RuntimeError: if `graph_ops` contains ops that are not in either python or c++ registry. """ missing_ops = graph_ops...
[ "Register", "graph", "ops", "absent", "in", "op_def_registry", "if", "present", "in", "c", "++", "registry", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L773-L814
[ "def", "register_ops_if_needed", "(", "graph_ops", ")", ":", "missing_ops", "=", "graph_ops", "-", "set", "(", "op_def_registry", ".", "get_registered_ops", "(", ")", ".", "keys", "(", ")", ")", "if", "not", "missing_ops", ":", "return", "p_buffer", "=", "c_...
09f45963f6787322967b6fec61459f3ac56fbb27
train
fix_colocation_after_import
Fixes colocation attributes after import according to input_map. This function is meant to be called after importing a GraphDef, in order to rewrite colocate_with constrains analogous to how inputs to ops are rewritten by input_map during import. It also updates devices accordingly. The nodes in the given imp...
tensorflow_hub/native_module.py
def fix_colocation_after_import(input_map, absolute_import_scope): """Fixes colocation attributes after import according to input_map. This function is meant to be called after importing a GraphDef, in order to rewrite colocate_with constrains analogous to how inputs to ops are rewritten by input_map during im...
def fix_colocation_after_import(input_map, absolute_import_scope): """Fixes colocation attributes after import according to input_map. This function is meant to be called after importing a GraphDef, in order to rewrite colocate_with constrains analogous to how inputs to ops are rewritten by input_map during im...
[ "Fixes", "colocation", "attributes", "after", "import", "according", "to", "input_map", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L817-L870
[ "def", "fix_colocation_after_import", "(", "input_map", ",", "absolute_import_scope", ")", ":", "attr_map", "=", "_build_colocation_attr_map", "(", "input_map", ",", "absolute_import_scope", ")", "_apply_colocation_attr_map", "(", "attr_map", ",", "absolute_import_scope", "...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_build_colocation_attr_map
Returns a dict mapping from pre-import to post-import colocation attrs. Args: input_map: as for fix_colocation_after_import. absolute_import_scope: as for fix_colocation_after_import. Returns: A dict that maps bytes `"loc:@" + absolute_import_scope + "/foo"` to _ConsistentValues set to the lists o...
tensorflow_hub/native_module.py
def _build_colocation_attr_map(input_map, absolute_import_scope): """Returns a dict mapping from pre-import to post-import colocation attrs. Args: input_map: as for fix_colocation_after_import. absolute_import_scope: as for fix_colocation_after_import. Returns: A dict that maps bytes `"loc:@" + abso...
def _build_colocation_attr_map(input_map, absolute_import_scope): """Returns a dict mapping from pre-import to post-import colocation attrs. Args: input_map: as for fix_colocation_after_import. absolute_import_scope: as for fix_colocation_after_import. Returns: A dict that maps bytes `"loc:@" + abso...
[ "Returns", "a", "dict", "mapping", "from", "pre", "-", "import", "to", "post", "-", "import", "colocation", "attrs", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L918-L965
[ "def", "_build_colocation_attr_map", "(", "input_map", ",", "absolute_import_scope", ")", ":", "colocation_attr_map", "=", "collections", ".", "defaultdict", "(", "_ConsistentValue", ")", "used_outputs_of_imported_ops", "=", "collections", ".", "defaultdict", "(", "set", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_apply_colocation_attr_map
Rewrites colocation constraints in the current default graph. Nodes in `absolute_import_scope` get their "_class" attr lists rewritten according to `colocation_attr_map`: each entry that matches a key gets replaced by the associated values (with deduplication). The node's device is updated accordingly. Args...
tensorflow_hub/native_module.py
def _apply_colocation_attr_map(colocation_attr_map, absolute_import_scope): """Rewrites colocation constraints in the current default graph. Nodes in `absolute_import_scope` get their "_class" attr lists rewritten according to `colocation_attr_map`: each entry that matches a key gets replaced by the associated...
def _apply_colocation_attr_map(colocation_attr_map, absolute_import_scope): """Rewrites colocation constraints in the current default graph. Nodes in `absolute_import_scope` get their "_class" attr lists rewritten according to `colocation_attr_map`: each entry that matches a key gets replaced by the associated...
[ "Rewrites", "colocation", "constraints", "in", "the", "current", "default", "graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L968-L1037
[ "def", "_apply_colocation_attr_map", "(", "colocation_attr_map", ",", "absolute_import_scope", ")", ":", "graph", "=", "tf_v1", ".", "get_default_graph", "(", ")", "for", "op", "in", "graph", ".", "get_operations", "(", ")", ":", "# Rewrite the values of the \"_class\...
09f45963f6787322967b6fec61459f3ac56fbb27
train
find_state_op_colocation_error
Returns error message for colocation of state ops, or None if ok.
tensorflow_hub/native_module.py
def find_state_op_colocation_error(graph, reported_tags=None): """Returns error message for colocation of state ops, or None if ok.""" state_op_types = list_registered_stateful_ops_without_inputs() state_op_map = {op.name: op for op in graph.get_operations() if op.type in state_op_types} for o...
def find_state_op_colocation_error(graph, reported_tags=None): """Returns error message for colocation of state ops, or None if ok.""" state_op_types = list_registered_stateful_ops_without_inputs() state_op_map = {op.name: op for op in graph.get_operations() if op.type in state_op_types} for o...
[ "Returns", "error", "message", "for", "colocation", "of", "state", "ops", "or", "None", "if", "ok", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L1040-L1058
[ "def", "find_state_op_colocation_error", "(", "graph", ",", "reported_tags", "=", "None", ")", ":", "state_op_types", "=", "list_registered_stateful_ops_without_inputs", "(", ")", "state_op_map", "=", "{", "op", ".", "name", ":", "op", "for", "op", "in", "graph", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
find_signature_input_colocation_error
Returns error message for colocation of signature inputs, or None if ok.
tensorflow_hub/native_module.py
def find_signature_input_colocation_error(signature_name, inputs): """Returns error message for colocation of signature inputs, or None if ok.""" for input_name, tensor in inputs.items(): expected_colocation_groups = [tf.compat.as_bytes("loc:@" + tensor.op.name)] if tensor.op.colocation_groups() != expected...
def find_signature_input_colocation_error(signature_name, inputs): """Returns error message for colocation of signature inputs, or None if ok.""" for input_name, tensor in inputs.items(): expected_colocation_groups = [tf.compat.as_bytes("loc:@" + tensor.op.name)] if tensor.op.colocation_groups() != expected...
[ "Returns", "error", "message", "for", "colocation", "of", "signature", "inputs", "or", "None", "if", "ok", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L1061-L1072
[ "def", "find_signature_input_colocation_error", "(", "signature_name", ",", "inputs", ")", ":", "for", "input_name", ",", "tensor", "in", "inputs", ".", "items", "(", ")", ":", "expected_colocation_groups", "=", "[", "tf", ".", "compat", ".", "as_bytes", "(", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
find_signature_inputs_from_multivalued_ops
Returns error message for module inputs from ops with multiple outputs.
tensorflow_hub/native_module.py
def find_signature_inputs_from_multivalued_ops(inputs): """Returns error message for module inputs from ops with multiple outputs.""" dense_inputs = [] # List of (str, Tensor), with SparseTensors decomposed. for name, tensor in sorted(inputs.items()): if isinstance(tensor, tf.SparseTensor): dense_input...
def find_signature_inputs_from_multivalued_ops(inputs): """Returns error message for module inputs from ops with multiple outputs.""" dense_inputs = [] # List of (str, Tensor), with SparseTensors decomposed. for name, tensor in sorted(inputs.items()): if isinstance(tensor, tf.SparseTensor): dense_input...
[ "Returns", "error", "message", "for", "module", "inputs", "from", "ops", "with", "multiple", "outputs", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L1075-L1093
[ "def", "find_signature_inputs_from_multivalued_ops", "(", "inputs", ")", ":", "dense_inputs", "=", "[", "]", "# List of (str, Tensor), with SparseTensors decomposed.", "for", "name", ",", "tensor", "in", "sorted", "(", "inputs", ".", "items", "(", ")", ")", ":", "if...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ModuleSpec._export
Internal. Args: path: string where to export the module to. variables_saver: an unary-function that writes the module variables checkpoint on the given path.
tensorflow_hub/native_module.py
def _export(self, path, variables_saver): """Internal. Args: path: string where to export the module to. variables_saver: an unary-function that writes the module variables checkpoint on the given path. """ self._saved_model_handler.export(path, variables_saver=variables_saver) ...
def _export(self, path, variables_saver): """Internal. Args: path: string where to export the module to. variables_saver: an unary-function that writes the module variables checkpoint on the given path. """ self._saved_model_handler.export(path, variables_saver=variables_saver) ...
[ "Internal", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L342-L359
[ "def", "_export", "(", "self", ",", "path", ",", "variables_saver", ")", ":", "self", ".", "_saved_model_handler", ".", "export", "(", "path", ",", "variables_saver", "=", "variables_saver", ")", "module_def_proto", "=", "module_def_pb2", ".", "ModuleDef", "(", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ModuleImpl._create_state_graph
Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def to the created Variables objects. state_map: a map from ...
tensorflow_hub/native_module.py
def _create_state_graph(self, name): """Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def to the created Varia...
def _create_state_graph(self, name): """Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def to the created Varia...
[ "Creates", "the", "graph", "nodes", "that", "hold", "the", "state", "of", "the", "Module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L410-L470
[ "def", "_create_state_graph", "(", "self", ",", "name", ")", ":", "import_collections", "=", "[", "tf_v1", ".", "GraphKeys", ".", "GLOBAL_VARIABLES", ",", "tf_v1", ".", "GraphKeys", ".", "MODEL_VARIABLES", ",", "tf_v1", ".", "GraphKeys", ".", "TABLE_INITIALIZERS...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ModuleImpl.create_apply_graph
See `ModuleImpl.create_apply_graph`.
tensorflow_hub/native_module.py
def create_apply_graph(self, signature, input_tensors, name): """See `ModuleImpl.create_apply_graph`.""" signature_def = self._meta_graph.signature_def.get(signature) meta_graph = meta_graph_pb2.MetaGraphDef() meta_graph.CopyFrom(self._meta_graph) apply_graph = tf_v1.get_default_graph() infeed_m...
def create_apply_graph(self, signature, input_tensors, name): """See `ModuleImpl.create_apply_graph`.""" signature_def = self._meta_graph.signature_def.get(signature) meta_graph = meta_graph_pb2.MetaGraphDef() meta_graph.CopyFrom(self._meta_graph) apply_graph = tf_v1.get_default_graph() infeed_m...
[ "See", "ModuleImpl", ".", "create_apply_graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L472-L561
[ "def", "create_apply_graph", "(", "self", ",", "signature", ",", "input_tensors", ",", "name", ")", ":", "signature_def", "=", "self", ".", "_meta_graph", ".", "signature_def", ".", "get", "(", "signature", ")", "meta_graph", "=", "meta_graph_pb2", ".", "MetaG...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ModuleImpl.export
See `Module.export`.
tensorflow_hub/native_module.py
def export(self, path, session): """See `Module.export`.""" def variables_saver(variables_path): if self._saver: self._saver.save( session, variables_path, write_meta_graph=False, write_state=False) self._spec._export(path, variables_saver)
def export(self, path, session): """See `Module.export`.""" def variables_saver(variables_path): if self._saver: self._saver.save( session, variables_path, write_meta_graph=False, write_state=False) self._spec._export(path, variables_saver)
[ "See", "Module", ".", "export", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L569-L578
[ "def", "export", "(", "self", ",", "path", ",", "session", ")", ":", "def", "variables_saver", "(", "variables_path", ")", ":", "if", "self", ".", "_saver", ":", "self", ".", "_saver", ".", "save", "(", "session", ",", "variables_path", ",", "write_meta_...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ConsistentValue.Set
Receives a value for the object and some context on its source.
tensorflow_hub/native_module.py
def Set(self, value, context=None): """Receives a value for the object and some context on its source.""" if self.has_error: return if self.value is None: self.value = value self._context["old_value"] = value self._context.update({"old_" + k: v for k, v in context.items()}) elif self.v...
def Set(self, value, context=None): """Receives a value for the object and some context on its source.""" if self.has_error: return if self.value is None: self.value = value self._context["old_value"] = value self._context.update({"old_" + k: v for k, v in context.items()}) elif self.v...
[ "Receives", "a", "value", "for", "the", "object", "and", "some", "context", "on", "its", "source", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L897-L907
[ "def", "Set", "(", "self", ",", "value", ",", "context", "=", "None", ")", ":", "if", "self", ".", "has_error", ":", "return", "if", "self", ".", "value", "is", "None", ":", "self", ".", "value", "=", "value", "self", ".", "_context", "[", "\"old_v...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ConsistentValue.GetConsistentValueOrRaise
Gets consistent value or raises ValueError with formatted contexts.
tensorflow_hub/native_module.py
def GetConsistentValueOrRaise(self, error_format, context=None): """Gets consistent value or raises ValueError with formatted contexts.""" if self.has_error: full_context = dict(self._context) if context: full_context.update(context) raise ValueError(error_format.format(**full_context)) re...
def GetConsistentValueOrRaise(self, error_format, context=None): """Gets consistent value or raises ValueError with formatted contexts.""" if self.has_error: full_context = dict(self._context) if context: full_context.update(context) raise ValueError(error_format.format(**full_context)) re...
[ "Gets", "consistent", "value", "or", "raises", "ValueError", "with", "formatted", "contexts", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/native_module.py#L909-L915
[ "def", "GetConsistentValueOrRaise", "(", "self", ",", "error_format", ",", "context", "=", "None", ")", ":", "if", "self", ".", "has_error", ":", "full_context", "=", "dict", "(", "self", ".", "_context", ")", "if", "context", ":", "full_context", ".", "up...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_module_dir
Returns the directory where to cache the module.
tensorflow_hub/compressed_module_resolver.py
def _module_dir(handle): """Returns the directory where to cache the module.""" cache_dir = resolver.tfhub_cache_dir(use_temp=True) return resolver.create_local_module_dir( cache_dir, hashlib.sha1(handle.encode("utf8")).hexdigest())
def _module_dir(handle): """Returns the directory where to cache the module.""" cache_dir = resolver.tfhub_cache_dir(use_temp=True) return resolver.create_local_module_dir( cache_dir, hashlib.sha1(handle.encode("utf8")).hexdigest())
[ "Returns", "the", "directory", "where", "to", "cache", "the", "module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/compressed_module_resolver.py#L44-L49
[ "def", "_module_dir", "(", "handle", ")", ":", "cache_dir", "=", "resolver", ".", "tfhub_cache_dir", "(", "use_temp", "=", "True", ")", "return", "resolver", ".", "create_local_module_dir", "(", "cache_dir", ",", "hashlib", ".", "sha1", "(", "handle", ".", "...
09f45963f6787322967b6fec61459f3ac56fbb27
train
get_variables_path
Returns the path for storing variables checkpoints.
tensorflow_hub/saved_model_lib.py
def get_variables_path(export_dir): """Returns the path for storing variables checkpoints.""" return os.path.join( tf.compat.as_bytes(export_dir), tf.compat.as_bytes(tf_v1.saved_model.constants.VARIABLES_DIRECTORY), tf.compat.as_bytes(tf_v1.saved_model.constants.VARIABLES_FILENAME))
def get_variables_path(export_dir): """Returns the path for storing variables checkpoints.""" return os.path.join( tf.compat.as_bytes(export_dir), tf.compat.as_bytes(tf_v1.saved_model.constants.VARIABLES_DIRECTORY), tf.compat.as_bytes(tf_v1.saved_model.constants.VARIABLES_FILENAME))
[ "Returns", "the", "path", "for", "storing", "variables", "checkpoints", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L52-L57
[ "def", "get_variables_path", "(", "export_dir", ")", ":", "return", "os", ".", "path", ".", "join", "(", "tf", ".", "compat", ".", "as_bytes", "(", "export_dir", ")", ",", "tf", ".", "compat", ".", "as_bytes", "(", "tf_v1", ".", "saved_model", ".", "co...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_get_node_name_from_tensor
tensor_name must have format node_name:output_number. Returns node_name.
tensorflow_hub/saved_model_lib.py
def _get_node_name_from_tensor(tensor_name): """tensor_name must have format node_name:output_number. Returns node_name.""" result = re.match(r"([^:]*):\d+$", tensor_name) if not result: raise ValueError( "Unexpected format for tensor name. Expected node_name:output_number. " "Got %r" % tensor...
def _get_node_name_from_tensor(tensor_name): """tensor_name must have format node_name:output_number. Returns node_name.""" result = re.match(r"([^:]*):\d+$", tensor_name) if not result: raise ValueError( "Unexpected format for tensor name. Expected node_name:output_number. " "Got %r" % tensor...
[ "tensor_name", "must", "have", "format", "node_name", ":", "output_number", ".", "Returns", "node_name", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L84-L91
[ "def", "_get_node_name_from_tensor", "(", "tensor_name", ")", ":", "result", "=", "re", ".", "match", "(", "r\"([^:]*):\\d+$\"", ",", "tensor_name", ")", "if", "not", "result", ":", "raise", "ValueError", "(", "\"Unexpected format for tensor name. Expected node_name:out...
09f45963f6787322967b6fec61459f3ac56fbb27
train
add_signature
Adds a signature to current graph. Args: key: Signature key as a string. inputs: Signature inputs as a map from string to Tensor or SparseTensor. outputs: Signature outputs as a map from string to Tensor or SparseTensor. (Recall that a Variable is not a Tensor, but Variable.value() is.) Raises: ...
tensorflow_hub/saved_model_lib.py
def add_signature(key, inputs, outputs): """Adds a signature to current graph. Args: key: Signature key as a string. inputs: Signature inputs as a map from string to Tensor or SparseTensor. outputs: Signature outputs as a map from string to Tensor or SparseTensor. (Recall that a Variable is not a...
def add_signature(key, inputs, outputs): """Adds a signature to current graph. Args: key: Signature key as a string. inputs: Signature inputs as a map from string to Tensor or SparseTensor. outputs: Signature outputs as a map from string to Tensor or SparseTensor. (Recall that a Variable is not a...
[ "Adds", "a", "signature", "to", "current", "graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L94-L118
[ "def", "add_signature", "(", "key", ",", "inputs", ",", "outputs", ")", ":", "_check_dict_maps_to_tensors_or_sparse_tensors", "(", "inputs", ")", "_check_dict_maps_to_tensors_or_sparse_tensors", "(", "outputs", ")", "input_info", "=", "{", "input_name", ":", "tf_v1", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_export_signatures
Exports signatures from current graph into a MetaGraphDef.
tensorflow_hub/saved_model_lib.py
def _export_signatures(meta_graph): """Exports signatures from current graph into a MetaGraphDef.""" named_signatures = tf_v1.get_collection(_SIGNATURE_COLLECTION) if not named_signatures: raise ValueError("No signatures present. Please call hub.add_signature(...)" "at least once in the m...
def _export_signatures(meta_graph): """Exports signatures from current graph into a MetaGraphDef.""" named_signatures = tf_v1.get_collection(_SIGNATURE_COLLECTION) if not named_signatures: raise ValueError("No signatures present. Please call hub.add_signature(...)" "at least once in the m...
[ "Exports", "signatures", "from", "current", "graph", "into", "a", "MetaGraphDef", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L129-L136
[ "def", "_export_signatures", "(", "meta_graph", ")", ":", "named_signatures", "=", "tf_v1", ".", "get_collection", "(", "_SIGNATURE_COLLECTION", ")", "if", "not", "named_signatures", ":", "raise", "ValueError", "(", "\"No signatures present. Please call hub.add_signature(.....
09f45963f6787322967b6fec61459f3ac56fbb27
train
attach_bytes
Adds a ModuleAttachment to the current graph. Args: key: A string with the unique key of the attachment. the_bytes: A bytes object with the serialized attachment.
tensorflow_hub/saved_model_lib.py
def attach_bytes(key, the_bytes): """Adds a ModuleAttachment to the current graph. Args: key: A string with the unique key of the attachment. the_bytes: A bytes object with the serialized attachment. """ tf_v1.add_to_collection( _ATTACHMENT_COLLECTION_INTERNAL, module_attachment_pb2.ModuleA...
def attach_bytes(key, the_bytes): """Adds a ModuleAttachment to the current graph. Args: key: A string with the unique key of the attachment. the_bytes: A bytes object with the serialized attachment. """ tf_v1.add_to_collection( _ATTACHMENT_COLLECTION_INTERNAL, module_attachment_pb2.ModuleA...
[ "Adds", "a", "ModuleAttachment", "to", "the", "current", "graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L139-L148
[ "def", "attach_bytes", "(", "key", ",", "the_bytes", ")", ":", "tf_v1", ".", "add_to_collection", "(", "_ATTACHMENT_COLLECTION_INTERNAL", ",", "module_attachment_pb2", ".", "ModuleAttachment", "(", "key", "=", "key", ",", "value", "=", "the_bytes", ")", ")" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
_export_module_attachments
Exports ModuleAttachments from the current tf.Graph into `meta_graph`.
tensorflow_hub/saved_model_lib.py
def _export_module_attachments(meta_graph): """Exports ModuleAttachments from the current tf.Graph into `meta_graph`.""" added_attachments = tf_v1.get_collection(_ATTACHMENT_COLLECTION_INTERNAL) if not added_attachments: return # Don't touch `meta_graph`. unique_attachments = collections.OrderedDict( # Avoid ...
def _export_module_attachments(meta_graph): """Exports ModuleAttachments from the current tf.Graph into `meta_graph`.""" added_attachments = tf_v1.get_collection(_ATTACHMENT_COLLECTION_INTERNAL) if not added_attachments: return # Don't touch `meta_graph`. unique_attachments = collections.OrderedDict( # Avoid ...
[ "Exports", "ModuleAttachments", "from", "the", "current", "tf", ".", "Graph", "into", "meta_graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L151-L160
[ "def", "_export_module_attachments", "(", "meta_graph", ")", ":", "added_attachments", "=", "tf_v1", ".", "get_collection", "(", "_ATTACHMENT_COLLECTION_INTERNAL", ")", "if", "not", "added_attachments", ":", "return", "# Don't touch `meta_graph`.", "unique_attachments", "="...
09f45963f6787322967b6fec61459f3ac56fbb27
train
get_attached_bytes_map
Returns the dict of ModuleAttachments stored in `meta_graph`. Args: meta_graph: A MetaGraphDef, as built by SavedModelHandler.add_graph_copy() from some graph. Returns: A dict, containing the `(key, bytes)` items passed to `attach_bytes()` when the graph had been built. Raises: ValueError...
tensorflow_hub/saved_model_lib.py
def get_attached_bytes_map(meta_graph): """Returns the dict of ModuleAttachments stored in `meta_graph`. Args: meta_graph: A MetaGraphDef, as built by SavedModelHandler.add_graph_copy() from some graph. Returns: A dict, containing the `(key, bytes)` items passed to `attach_bytes()` when the gr...
def get_attached_bytes_map(meta_graph): """Returns the dict of ModuleAttachments stored in `meta_graph`. Args: meta_graph: A MetaGraphDef, as built by SavedModelHandler.add_graph_copy() from some graph. Returns: A dict, containing the `(key, bytes)` items passed to `attach_bytes()` when the gr...
[ "Returns", "the", "dict", "of", "ModuleAttachments", "stored", "in", "meta_graph", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L163-L189
[ "def", "get_attached_bytes_map", "(", "meta_graph", ")", ":", "result", "=", "{", "}", "if", "ATTACHMENT_COLLECTION_SAVED", "not", "in", "meta_graph", ".", "collection_def", ":", "return", "result", "collection_def", "=", "meta_graph", ".", "collection_def", "[", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_check_asset_node_def
Raises TypeError if `node_def` does not match the expectations.
tensorflow_hub/saved_model_lib.py
def _check_asset_node_def(node_def): """Raises TypeError if `node_def` does not match the expectations.""" if node_def.op != "Const": raise TypeError("Asset node must be of type constant.") if tf.as_dtype(node_def.attr["dtype"].type) != tf.string: raise TypeError("Asset node must be of dtype string.") i...
def _check_asset_node_def(node_def): """Raises TypeError if `node_def` does not match the expectations.""" if node_def.op != "Const": raise TypeError("Asset node must be of type constant.") if tf.as_dtype(node_def.attr["dtype"].type) != tf.string: raise TypeError("Asset node must be of dtype string.") i...
[ "Raises", "TypeError", "if", "node_def", "does", "not", "match", "the", "expectations", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L198-L205
[ "def", "_check_asset_node_def", "(", "node_def", ")", ":", "if", "node_def", ".", "op", "!=", "\"Const\"", ":", "raise", "TypeError", "(", "\"Asset node must be of type constant.\"", ")", "if", "tf", ".", "as_dtype", "(", "node_def", ".", "attr", "[", "\"dtype\"...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_merge_assets_key_collection
Merges the ASSETS_KEY collection into the GraphDefs in saved_model_proto. Removes the ASSETS_KEY collection from the GraphDefs in the SavedModel and modifies nodes with the assets filenames to point to the assets in `path`. After this transformation, the SavedModel GraphDefs can be used without feeding asset t...
tensorflow_hub/saved_model_lib.py
def _merge_assets_key_collection(saved_model_proto, path): """Merges the ASSETS_KEY collection into the GraphDefs in saved_model_proto. Removes the ASSETS_KEY collection from the GraphDefs in the SavedModel and modifies nodes with the assets filenames to point to the assets in `path`. After this transformation...
def _merge_assets_key_collection(saved_model_proto, path): """Merges the ASSETS_KEY collection into the GraphDefs in saved_model_proto. Removes the ASSETS_KEY collection from the GraphDefs in the SavedModel and modifies nodes with the assets filenames to point to the assets in `path`. After this transformation...
[ "Merges", "the", "ASSETS_KEY", "collection", "into", "the", "GraphDefs", "in", "saved_model_proto", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L208-L237
[ "def", "_merge_assets_key_collection", "(", "saved_model_proto", ",", "path", ")", ":", "for", "meta_graph", "in", "saved_model_proto", ".", "meta_graphs", ":", "node_asset_map", "=", "{", "}", "if", "tf_v1", ".", "saved_model", ".", "constants", ".", "ASSETS_KEY"...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_make_assets_key_collection
Creates an ASSETS_KEY collection in the GraphDefs in saved_model_proto. Adds an ASSETS_KEY collection to the GraphDefs in the SavedModel and returns a map from original asset filename to filename when exporting the SavedModel to `export_path`. This is roughly the inverse operation of `_merge_assets_key_collec...
tensorflow_hub/saved_model_lib.py
def _make_assets_key_collection(saved_model_proto, export_path): """Creates an ASSETS_KEY collection in the GraphDefs in saved_model_proto. Adds an ASSETS_KEY collection to the GraphDefs in the SavedModel and returns a map from original asset filename to filename when exporting the SavedModel to `export_path`....
def _make_assets_key_collection(saved_model_proto, export_path): """Creates an ASSETS_KEY collection in the GraphDefs in saved_model_proto. Adds an ASSETS_KEY collection to the GraphDefs in the SavedModel and returns a map from original asset filename to filename when exporting the SavedModel to `export_path`....
[ "Creates", "an", "ASSETS_KEY", "collection", "in", "the", "GraphDefs", "in", "saved_model_proto", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L240-L320
[ "def", "_make_assets_key_collection", "(", "saved_model_proto", ",", "export_path", ")", ":", "asset_filenames", "=", "{", "}", "used_asset_filenames", "=", "set", "(", ")", "def", "_make_asset_filename", "(", "original_filename", ")", ":", "\"\"\"Returns the asset file...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_parse_saved_model
Reads the savedmodel.pb file containing `SavedModel`.
tensorflow_hub/saved_model_lib.py
def _parse_saved_model(path): """Reads the savedmodel.pb file containing `SavedModel`.""" # Based on tensorflow/python/saved_model/loader.py implementation. path_to_pb = _get_saved_model_proto_path(path) file_content = tf_v1.gfile.Open(path_to_pb, "rb").read() saved_model = saved_model_pb2.SavedModel() try:...
def _parse_saved_model(path): """Reads the savedmodel.pb file containing `SavedModel`.""" # Based on tensorflow/python/saved_model/loader.py implementation. path_to_pb = _get_saved_model_proto_path(path) file_content = tf_v1.gfile.Open(path_to_pb, "rb").read() saved_model = saved_model_pb2.SavedModel() try:...
[ "Reads", "the", "savedmodel", ".", "pb", "file", "containing", "SavedModel", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L441-L451
[ "def", "_parse_saved_model", "(", "path", ")", ":", "# Based on tensorflow/python/saved_model/loader.py implementation.", "path_to_pb", "=", "_get_saved_model_proto_path", "(", "path", ")", "file_content", "=", "tf_v1", ".", "gfile", ".", "Open", "(", "path_to_pb", ",", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
load
Creates a SavedModelHandler from a SavedModel in `path`.
tensorflow_hub/saved_model_lib.py
def load(path): """Creates a SavedModelHandler from a SavedModel in `path`.""" proto = _parse_saved_model(path) _merge_assets_key_collection(proto, path) handler = SavedModelHandler() handler._proto = proto # pylint: disable=protected-access return handler
def load(path): """Creates a SavedModelHandler from a SavedModel in `path`.""" proto = _parse_saved_model(path) _merge_assets_key_collection(proto, path) handler = SavedModelHandler() handler._proto = proto # pylint: disable=protected-access return handler
[ "Creates", "a", "SavedModelHandler", "from", "a", "SavedModel", "in", "path", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L454-L460
[ "def", "load", "(", "path", ")", ":", "proto", "=", "_parse_saved_model", "(", "path", ")", "_merge_assets_key_collection", "(", "proto", ",", "path", ")", "handler", "=", "SavedModelHandler", "(", ")", "handler", ".", "_proto", "=", "proto", "# pylint: disabl...
09f45963f6787322967b6fec61459f3ac56fbb27
train
SavedModelHandler.add_graph_copy
Adds a copy of Graph with the specified set of tags.
tensorflow_hub/saved_model_lib.py
def add_graph_copy(self, graph, tags=None): """Adds a copy of Graph with the specified set of tags.""" with graph.as_default(): # Remove default attrs so that Modules created by a tensorflow version # with ops that have new attrs that are left to their default values can # still be loaded by o...
def add_graph_copy(self, graph, tags=None): """Adds a copy of Graph with the specified set of tags.""" with graph.as_default(): # Remove default attrs so that Modules created by a tensorflow version # with ops that have new attrs that are left to their default values can # still be loaded by o...
[ "Adds", "a", "copy", "of", "Graph", "with", "the", "specified", "set", "of", "tags", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L357-L367
[ "def", "add_graph_copy", "(", "self", ",", "graph", ",", "tags", "=", "None", ")", ":", "with", "graph", ".", "as_default", "(", ")", ":", "# Remove default attrs so that Modules created by a tensorflow version", "# with ops that have new attrs that are left to their default ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
SavedModelHandler.get_meta_graph_copy
Returns a copy of a MetaGraph with the identical set of tags.
tensorflow_hub/saved_model_lib.py
def get_meta_graph_copy(self, tags=None): """Returns a copy of a MetaGraph with the identical set of tags.""" meta_graph = self.get_meta_graph(tags) copy = tf_v1.MetaGraphDef() copy.CopyFrom(meta_graph) return copy
def get_meta_graph_copy(self, tags=None): """Returns a copy of a MetaGraph with the identical set of tags.""" meta_graph = self.get_meta_graph(tags) copy = tf_v1.MetaGraphDef() copy.CopyFrom(meta_graph) return copy
[ "Returns", "a", "copy", "of", "a", "MetaGraph", "with", "the", "identical", "set", "of", "tags", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L372-L377
[ "def", "get_meta_graph_copy", "(", "self", ",", "tags", "=", "None", ")", ":", "meta_graph", "=", "self", ".", "get_meta_graph", "(", "tags", ")", "copy", "=", "tf_v1", ".", "MetaGraphDef", "(", ")", "copy", ".", "CopyFrom", "(", "meta_graph", ")", "retu...
09f45963f6787322967b6fec61459f3ac56fbb27
train
SavedModelHandler.get_tags
Returns a list of set of tags.
tensorflow_hub/saved_model_lib.py
def get_tags(self): """Returns a list of set of tags.""" return sorted([frozenset(meta_graph.meta_info_def.tags) for meta_graph in self.meta_graphs])
def get_tags(self): """Returns a list of set of tags.""" return sorted([frozenset(meta_graph.meta_info_def.tags) for meta_graph in self.meta_graphs])
[ "Returns", "a", "list", "of", "set", "of", "tags", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L383-L386
[ "def", "get_tags", "(", "self", ")", ":", "return", "sorted", "(", "[", "frozenset", "(", "meta_graph", ".", "meta_info_def", ".", "tags", ")", "for", "meta_graph", "in", "self", ".", "meta_graphs", "]", ")" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
SavedModelHandler.export
Exports to SavedModel directory. Args: path: path where to export the SavedModel to. variables_saver: lambda that receives a directory path where to export checkpoints of variables.
tensorflow_hub/saved_model_lib.py
def export(self, path, variables_saver=None): """Exports to SavedModel directory. Args: path: path where to export the SavedModel to. variables_saver: lambda that receives a directory path where to export checkpoints of variables. """ # Operate on a copy of self._proto since it need...
def export(self, path, variables_saver=None): """Exports to SavedModel directory. Args: path: path where to export the SavedModel to. variables_saver: lambda that receives a directory path where to export checkpoints of variables. """ # Operate on a copy of self._proto since it need...
[ "Exports", "to", "SavedModel", "directory", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L391-L406
[ "def", "export", "(", "self", ",", "path", ",", "variables_saver", "=", "None", ")", ":", "# Operate on a copy of self._proto since it needs to be modified.", "proto", "=", "saved_model_pb2", ".", "SavedModel", "(", ")", "proto", ".", "CopyFrom", "(", "self", ".", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
SavedModelHandler.get_meta_graph
Returns the matching MetaGraphDef or raises KeyError.
tensorflow_hub/saved_model_lib.py
def get_meta_graph(self, tags=None): """Returns the matching MetaGraphDef or raises KeyError.""" matches = [meta_graph for meta_graph in self.meta_graphs if set(meta_graph.meta_info_def.tags) == set(tags or [])] if not matches: raise KeyError("SavedModelHandler has no gra...
def get_meta_graph(self, tags=None): """Returns the matching MetaGraphDef or raises KeyError.""" matches = [meta_graph for meta_graph in self.meta_graphs if set(meta_graph.meta_info_def.tags) == set(tags or [])] if not matches: raise KeyError("SavedModelHandler has no gra...
[ "Returns", "the", "matching", "MetaGraphDef", "or", "raises", "KeyError", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/saved_model_lib.py#L408-L418
[ "def", "get_meta_graph", "(", "self", ",", "tags", "=", "None", ")", ":", "matches", "=", "[", "meta_graph", "for", "meta_graph", "in", "self", ".", "meta_graphs", "if", "set", "(", "meta_graph", ".", "meta_info_def", ".", "tags", ")", "==", "set", "(", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
KerasLayer._add_existing_weight
Calls add_weight() to register but not create an existing weight.
tensorflow_hub/keras_layer.py
def _add_existing_weight(self, weight, trainable=None): """Calls add_weight() to register but not create an existing weight.""" if trainable is None: trainable = weight.trainable self.add_weight(name=weight.name, shape=weight.shape, dtype=weight.dtype, trainable=trainable, getter=lambda ...
def _add_existing_weight(self, weight, trainable=None): """Calls add_weight() to register but not create an existing weight.""" if trainable is None: trainable = weight.trainable self.add_weight(name=weight.name, shape=weight.shape, dtype=weight.dtype, trainable=trainable, getter=lambda ...
[ "Calls", "add_weight", "()", "to", "register", "but", "not", "create", "an", "existing", "weight", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/keras_layer.py#L138-L142
[ "def", "_add_existing_weight", "(", "self", ",", "weight", ",", "trainable", "=", "None", ")", ":", "if", "trainable", "is", "None", ":", "trainable", "=", "weight", ".", "trainable", "self", ".", "add_weight", "(", "name", "=", "weight", ".", "name", ",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
export_module_spec
Helper function to ModuleSpec.export().
tensorflow_hub/module.py
def export_module_spec(spec, path, checkpoint_path, name_transform_fn): """Helper function to ModuleSpec.export().""" with tf.Graph().as_default(): m = Module(spec) assign_map = { name_transform_fn(name): value for name, value in m.variable_map.items() } tf_v1.train.init_from_checkpoint(chec...
def export_module_spec(spec, path, checkpoint_path, name_transform_fn): """Helper function to ModuleSpec.export().""" with tf.Graph().as_default(): m = Module(spec) assign_map = { name_transform_fn(name): value for name, value in m.variable_map.items() } tf_v1.train.init_from_checkpoint(chec...
[ "Helper", "function", "to", "ModuleSpec", ".", "export", "()", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L64-L75
[ "def", "export_module_spec", "(", "spec", ",", "path", ",", "checkpoint_path", ",", "name_transform_fn", ")", ":", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", ":", "m", "=", "Module", "(", "spec", ")", "assign_map", "=", "{", "na...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_try_get_state_scope
Returns a fresh variable/name scope for a module's state. In order to import a module into a given scope without major complications we require the scope to be empty. This function deals with deciding an unused scope where to define the module state. This is non trivial in cases where name_scope and variable_s...
tensorflow_hub/module.py
def _try_get_state_scope(name, mark_name_scope_used=True): """Returns a fresh variable/name scope for a module's state. In order to import a module into a given scope without major complications we require the scope to be empty. This function deals with deciding an unused scope where to define the module state...
def _try_get_state_scope(name, mark_name_scope_used=True): """Returns a fresh variable/name scope for a module's state. In order to import a module into a given scope without major complications we require the scope to be empty. This function deals with deciding an unused scope where to define the module state...
[ "Returns", "a", "fresh", "variable", "/", "name", "scope", "for", "a", "module", "s", "state", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L352-L385
[ "def", "_try_get_state_scope", "(", "name", ",", "mark_name_scope_used", "=", "True", ")", ":", "tmp_scope_name", "=", "tf_v1", ".", "get_variable_scope", "(", ")", ".", "name", "if", "tmp_scope_name", ":", "tmp_scope_name", "+=", "\"/\"", "with", "tf", ".", "...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_prepare_dict_inputs
Converts inputs to a dict of inputs and checks extra/missing args. Args: inputs: inputs fed to Module.__call__(). tensor_info_map: A map from string to `tensor_info.ParsedTensorInfo` describing the signature inputs. Returns: A dict of values with the same keys as tensor_info_map. Raises: ...
tensorflow_hub/module.py
def _prepare_dict_inputs(inputs, tensor_info_map): """Converts inputs to a dict of inputs and checks extra/missing args. Args: inputs: inputs fed to Module.__call__(). tensor_info_map: A map from string to `tensor_info.ParsedTensorInfo` describing the signature inputs. Returns: A dict of value...
def _prepare_dict_inputs(inputs, tensor_info_map): """Converts inputs to a dict of inputs and checks extra/missing args. Args: inputs: inputs fed to Module.__call__(). tensor_info_map: A map from string to `tensor_info.ParsedTensorInfo` describing the signature inputs. Returns: A dict of value...
[ "Converts", "inputs", "to", "a", "dict", "of", "inputs", "and", "checks", "extra", "/", "missing", "args", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L388-L421
[ "def", "_prepare_dict_inputs", "(", "inputs", ",", "tensor_info_map", ")", ":", "if", "inputs", "is", "None", ":", "dict_inputs", "=", "{", "}", "elif", "isinstance", "(", "inputs", ",", "dict", ")", ":", "dict_inputs", "=", "inputs", "elif", "len", "(", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_convert_dict_inputs
Converts from inputs into dict of input tensors. This handles: - putting inputs into a dict, per _prepare_dict_inputs(), - converting all input values into tensors compatible with the expected input tensor (dtype, shape). - check sparse/non-sparse tensor types. Args: inputs: inputs fed to Mo...
tensorflow_hub/module.py
def _convert_dict_inputs(inputs, tensor_info_map): """Converts from inputs into dict of input tensors. This handles: - putting inputs into a dict, per _prepare_dict_inputs(), - converting all input values into tensors compatible with the expected input tensor (dtype, shape). - check sparse/non-sp...
def _convert_dict_inputs(inputs, tensor_info_map): """Converts from inputs into dict of input tensors. This handles: - putting inputs into a dict, per _prepare_dict_inputs(), - converting all input values into tensors compatible with the expected input tensor (dtype, shape). - check sparse/non-sp...
[ "Converts", "from", "inputs", "into", "dict", "of", "input", "tensors", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L424-L447
[ "def", "_convert_dict_inputs", "(", "inputs", ",", "tensor_info_map", ")", ":", "dict_inputs", "=", "_prepare_dict_inputs", "(", "inputs", ",", "tensor_info_map", ")", "return", "tensor_info", ".", "convert_dict_to_compatible_tensor", "(", "dict_inputs", ",", "tensor_in...
09f45963f6787322967b6fec61459f3ac56fbb27
train
eval_function_for_module
Context manager that yields a function to directly evaluate a Module. This creates a separate graph, in which all of the signatures of the module are instantiated. Then, it creates a session and initializes the module variables. Finally, it returns a function which can be used to evaluate the module signatures...
tensorflow_hub/module.py
def eval_function_for_module(spec, tags=None): """Context manager that yields a function to directly evaluate a Module. This creates a separate graph, in which all of the signatures of the module are instantiated. Then, it creates a session and initializes the module variables. Finally, it returns a function w...
def eval_function_for_module(spec, tags=None): """Context manager that yields a function to directly evaluate a Module. This creates a separate graph, in which all of the signatures of the module are instantiated. Then, it creates a session and initializes the module variables. Finally, it returns a function w...
[ "Context", "manager", "that", "yields", "a", "function", "to", "directly", "evaluate", "a", "Module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L474-L559
[ "def", "eval_function_for_module", "(", "spec", ",", "tags", "=", "None", ")", ":", "# We create a separate graph and add all the signatures of the module to it.", "original_graph", "=", "tf_v1", ".", "get_default_graph", "(", ")", "with", "tf", ".", "Graph", "(", ")", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
load
Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tensorflow Hub module to a l...
tensorflow_hub/module.py
def load(handle): """Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tenso...
def load(handle): """Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tenso...
[ "Loads", "a", "module", "from", "a", "handle", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L577-L613
[ "def", "load", "(", "handle", ")", ":", "if", "hasattr", "(", "tf_v1", ".", "saved_model", ",", "\"load_v2\"", ")", ":", "module_handle", "=", "resolve", "(", "handle", ")", "return", "tf_v1", ".", "saved_model", ".", "load_v2", "(", "module_handle", ")", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
Module.get_input_info_dict
Describes the inputs required by a signature. Args: signature: A string with the signature to get inputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_input_info_dict() for the given signature, and the graph variant selected...
tensorflow_hub/module.py
def get_input_info_dict(self, signature=None): """Describes the inputs required by a signature. Args: signature: A string with the signature to get inputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_input_info_dict() for the...
def get_input_info_dict(self, signature=None): """Describes the inputs required by a signature. Args: signature: A string with the signature to get inputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_input_info_dict() for the...
[ "Describes", "the", "inputs", "required", "by", "a", "signature", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L257-L271
[ "def", "get_input_info_dict", "(", "self", ",", "signature", "=", "None", ")", ":", "return", "self", ".", "_spec", ".", "get_input_info_dict", "(", "signature", "=", "signature", ",", "tags", "=", "self", ".", "_tags", ")" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
Module.get_output_info_dict
Describes the outputs provided by a signature. Args: signature: A string with the signature to get ouputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_output_info_dict() for the given signature, and the graph variant select...
tensorflow_hub/module.py
def get_output_info_dict(self, signature=None): """Describes the outputs provided by a signature. Args: signature: A string with the signature to get ouputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_output_info_dict() for ...
def get_output_info_dict(self, signature=None): """Describes the outputs provided by a signature. Args: signature: A string with the signature to get ouputs information for. If None, the default signature is used if defined. Returns: The result of ModuleSpec.get_output_info_dict() for ...
[ "Describes", "the", "outputs", "provided", "by", "a", "signature", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L273-L287
[ "def", "get_output_info_dict", "(", "self", ",", "signature", "=", "None", ")", ":", "return", "self", ".", "_spec", ".", "get_output_info_dict", "(", "signature", "=", "signature", ",", "tags", "=", "self", ".", "_tags", ")" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
Module.get_attached_message
Calls ModuleSpec.get_attached_message(); see there for more.
tensorflow_hub/module.py
def get_attached_message(self, key, message_type, required=False): """Calls ModuleSpec.get_attached_message(); see there for more.""" return self._spec.get_attached_message(key, message_type, tags=self._tags, required=required)
def get_attached_message(self, key, message_type, required=False): """Calls ModuleSpec.get_attached_message(); see there for more.""" return self._spec.get_attached_message(key, message_type, tags=self._tags, required=required)
[ "Calls", "ModuleSpec", ".", "get_attached_message", "()", ";", "see", "there", "for", "more", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L289-L292
[ "def", "get_attached_message", "(", "self", ",", "key", ",", "message_type", ",", "required", "=", "False", ")", ":", "return", "self", ".", "_spec", ".", "get_attached_message", "(", "key", ",", "message_type", ",", "tags", "=", "self", ".", "_tags", ",",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
Module.export
Exports the module with the variables from the session in `path`. Note that it is the module definition in the ModuleSpec used to create this module that gets exported. The session is only used to provide the value of variables. Args: path: path where to export the module to. session: sess...
tensorflow_hub/module.py
def export(self, path, session): """Exports the module with the variables from the session in `path`. Note that it is the module definition in the ModuleSpec used to create this module that gets exported. The session is only used to provide the value of variables. Args: path: path where to e...
def export(self, path, session): """Exports the module with the variables from the session in `path`. Note that it is the module definition in the ModuleSpec used to create this module that gets exported. The session is only used to provide the value of variables. Args: path: path where to e...
[ "Exports", "the", "module", "with", "the", "variables", "from", "the", "session", "in", "path", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L294-L314
[ "def", "export", "(", "self", ",", "path", ",", "session", ")", ":", "if", "self", ".", "_graph", "is", "not", "tf_v1", ".", "get_default_graph", "(", ")", ":", "raise", "RuntimeError", "(", "\"default graph differs from the graph where the \"", "\"module was inst...
09f45963f6787322967b6fec61459f3ac56fbb27
train
Module.variables
Returns the list of all tf.Variables created by module instantiation.
tensorflow_hub/module.py
def variables(self): """Returns the list of all tf.Variables created by module instantiation.""" result = [] for _, value in sorted(self.variable_map.items()): if isinstance(value, list): result.extend(value) else: result.append(value) return result
def variables(self): """Returns the list of all tf.Variables created by module instantiation.""" result = [] for _, value in sorted(self.variable_map.items()): if isinstance(value, list): result.extend(value) else: result.append(value) return result
[ "Returns", "the", "list", "of", "all", "tf", ".", "Variables", "created", "by", "module", "instantiation", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module.py#L341-L349
[ "def", "variables", "(", "self", ")", ":", "result", "=", "[", "]", "for", "_", ",", "value", "in", "sorted", "(", "self", ".", "variable_map", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "result", "...
09f45963f6787322967b6fec61459f3ac56fbb27
train
text_embedding_column
Uses a Module to construct a dense representation from a text feature. This feature column can be used on an input feature whose values are strings of arbitrary size. The result of this feature column is the result of passing its `input` through the module `m` instantiated from `module_spec`, as per `result...
tensorflow_hub/feature_column.py
def text_embedding_column(key, module_spec, trainable=False): """Uses a Module to construct a dense representation from a text feature. This feature column can be used on an input feature whose values are strings of arbitrary size. The result of this feature column is the result of passing its `input` throu...
def text_embedding_column(key, module_spec, trainable=False): """Uses a Module to construct a dense representation from a text feature. This feature column can be used on an input feature whose values are strings of arbitrary size. The result of this feature column is the result of passing its `input` throu...
[ "Uses", "a", "Module", "to", "construct", "a", "dense", "representation", "from", "a", "text", "feature", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L33-L80
[ "def", "text_embedding_column", "(", "key", ",", "module_spec", ",", "trainable", "=", "False", ")", ":", "module_spec", "=", "module", ".", "as_module_spec", "(", "module_spec", ")", "_check_module_is_text_embedding", "(", "module_spec", ")", "return", "_TextEmbedd...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_check_module_is_text_embedding
Raises ValueError if `module_spec` is not a text-embedding module. Args: module_spec: A `ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with Tensor(string, shape=(?,)) -> Tensor(float32, shape=(?,K)).
tensorflow_hub/feature_column.py
def _check_module_is_text_embedding(module_spec): """Raises ValueError if `module_spec` is not a text-embedding module. Args: module_spec: A `ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with Tensor(string, shape=(?,)) -> Tensor(float32, shape=(?,K))....
def _check_module_is_text_embedding(module_spec): """Raises ValueError if `module_spec` is not a text-embedding module. Args: module_spec: A `ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with Tensor(string, shape=(?,)) -> Tensor(float32, shape=(?,K))....
[ "Raises", "ValueError", "if", "module_spec", "is", "not", "a", "text", "-", "embedding", "module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L83-L124
[ "def", "_check_module_is_text_embedding", "(", "module_spec", ")", ":", "issues", "=", "[", "]", "# Find issues with signature inputs.", "input_info_dict", "=", "module_spec", ".", "get_input_info_dict", "(", ")", "if", "len", "(", "input_info_dict", ")", "!=", "1", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
image_embedding_column
Uses a Module to get a dense 1-D representation from the pixels of images. This feature column can be used on images, represented as float32 tensors of RGB pixel data in the range [0,1]. This can be read from a numeric_column() if the tf.Example input data happens to have decoded images, all with the same shap...
tensorflow_hub/feature_column.py
def image_embedding_column(key, module_spec): """Uses a Module to get a dense 1-D representation from the pixels of images. This feature column can be used on images, represented as float32 tensors of RGB pixel data in the range [0,1]. This can be read from a numeric_column() if the tf.Example input data happe...
def image_embedding_column(key, module_spec): """Uses a Module to get a dense 1-D representation from the pixels of images. This feature column can be used on images, represented as float32 tensors of RGB pixel data in the range [0,1]. This can be read from a numeric_column() if the tf.Example input data happe...
[ "Uses", "a", "Module", "to", "get", "a", "dense", "1", "-", "D", "representation", "from", "the", "pixels", "of", "images", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L162-L201
[ "def", "image_embedding_column", "(", "key", ",", "module_spec", ")", ":", "module_spec", "=", "module", ".", "as_module_spec", "(", "module_spec", ")", "_check_module_is_image_embedding", "(", "module_spec", ")", "return", "_ImageEmbeddingColumn", "(", "key", "=", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_check_module_is_image_embedding
Raises ValueError if `module_spec` is not usable as image embedding. Args: module_spec: A `_ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with mappingan "images" input to a Tensor(float32, shape=(_,K)).
tensorflow_hub/feature_column.py
def _check_module_is_image_embedding(module_spec): """Raises ValueError if `module_spec` is not usable as image embedding. Args: module_spec: A `_ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with mappingan "images" input to a Tensor(float32, shape...
def _check_module_is_image_embedding(module_spec): """Raises ValueError if `module_spec` is not usable as image embedding. Args: module_spec: A `_ModuleSpec` to test. Raises: ValueError: if `module_spec` default signature is not compatible with mappingan "images" input to a Tensor(float32, shape...
[ "Raises", "ValueError", "if", "module_spec", "is", "not", "usable", "as", "image", "embedding", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L204-L245
[ "def", "_check_module_is_image_embedding", "(", "module_spec", ")", ":", "issues", "=", "[", "]", "# Find issues with \"default\" signature inputs. The common signatures for", "# image models prescribe a specific name; we trust it if we find it", "# and if we can do the necessary inference o...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_TextEmbeddingColumn.name
Returns string. Used for variable_scope and naming.
tensorflow_hub/feature_column.py
def name(self): """Returns string. Used for variable_scope and naming.""" if not hasattr(self, "_name"): self._name = "{}_hub_module_embedding".format(self.key) return self._name
def name(self): """Returns string. Used for variable_scope and naming.""" if not hasattr(self, "_name"): self._name = "{}_hub_module_embedding".format(self.key) return self._name
[ "Returns", "string", ".", "Used", "for", "variable_scope", "and", "naming", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L134-L138
[ "def", "name", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_name\"", ")", ":", "self", ".", "_name", "=", "\"{}_hub_module_embedding\"", ".", "format", "(", "self", ".", "key", ")", "return", "self", ".", "_name" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
_TextEmbeddingColumn._get_dense_tensor
Returns a `Tensor`.
tensorflow_hub/feature_column.py
def _get_dense_tensor(self, inputs, weight_collections=None, trainable=None): """Returns a `Tensor`.""" del weight_collections text_batch = tf.reshape(inputs.get(self), shape=[-1]) m = module.Module(self.module_spec, trainable=self.trainable and trainable) return m(text_batch)
def _get_dense_tensor(self, inputs, weight_collections=None, trainable=None): """Returns a `Tensor`.""" del weight_collections text_batch = tf.reshape(inputs.get(self), shape=[-1]) m = module.Module(self.module_spec, trainable=self.trainable and trainable) return m(text_batch)
[ "Returns", "a", "Tensor", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L154-L159
[ "def", "_get_dense_tensor", "(", "self", ",", "inputs", ",", "weight_collections", "=", "None", ",", "trainable", "=", "None", ")", ":", "del", "weight_collections", "text_batch", "=", "tf", ".", "reshape", "(", "inputs", ".", "get", "(", "self", ")", ",",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ImageEmbeddingColumn._parse_example_spec
Returns a `tf.Example` parsing spec as dict.
tensorflow_hub/feature_column.py
def _parse_example_spec(self): """Returns a `tf.Example` parsing spec as dict.""" height, width = image_util.get_expected_image_size(self.module_spec) input_shape = [height, width, 3] return {self.key: tf_v1.FixedLenFeature(input_shape, tf.float32)}
def _parse_example_spec(self): """Returns a `tf.Example` parsing spec as dict.""" height, width = image_util.get_expected_image_size(self.module_spec) input_shape = [height, width, 3] return {self.key: tf_v1.FixedLenFeature(input_shape, tf.float32)}
[ "Returns", "a", "tf", ".", "Example", "parsing", "spec", "as", "dict", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L265-L269
[ "def", "_parse_example_spec", "(", "self", ")", ":", "height", ",", "width", "=", "image_util", ".", "get_expected_image_size", "(", "self", ".", "module_spec", ")", "input_shape", "=", "[", "height", ",", "width", ",", "3", "]", "return", "{", "self", "."...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_ImageEmbeddingColumn._get_dense_tensor
Returns a `Tensor` to represent this feature in the input_layer().
tensorflow_hub/feature_column.py
def _get_dense_tensor(self, inputs, weight_collections=None, trainable=None): """Returns a `Tensor` to represent this feature in the input_layer().""" del weight_collections, trainable # Unused. m = module.Module(self.module_spec, trainable=False) images = inputs.get(self) return m({"images": image...
def _get_dense_tensor(self, inputs, weight_collections=None, trainable=None): """Returns a `Tensor` to represent this feature in the input_layer().""" del weight_collections, trainable # Unused. m = module.Module(self.module_spec, trainable=False) images = inputs.get(self) return m({"images": image...
[ "Returns", "a", "Tensor", "to", "represent", "this", "feature", "in", "the", "input_layer", "()", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/feature_column.py#L276-L281
[ "def", "_get_dense_tensor", "(", "self", ",", "inputs", ",", "weight_collections", "=", "None", ",", "trainable", "=", "None", ")", ":", "del", "weight_collections", ",", "trainable", "# Unused.", "m", "=", "module", ".", "Module", "(", "self", ".", "module_...
09f45963f6787322967b6fec61459f3ac56fbb27
train
load
Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tensorflow Hub module to a l...
tensorflow_hub/module_v2.py
def load(handle): """Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tenso...
def load(handle): """Loads a module from a handle. Currently this method only works with Tensorflow 2.x and can only load modules created by calling tensorflow.saved_model.save(). The method works in both eager and graph modes. Depending on the type of handle used, the call may involve downloading a Tenso...
[ "Loads", "a", "module", "from", "a", "handle", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/module_v2.py#L43-L83
[ "def", "load", "(", "handle", ")", ":", "if", "hasattr", "(", "tf_v1", ".", "saved_model", ",", "\"load_v2\"", ")", ":", "module_handle", "=", "resolve", "(", "handle", ")", "if", "tf_v1", ".", "gfile", ".", "Exists", "(", "native_module", ".", "get_modu...
09f45963f6787322967b6fec61459f3ac56fbb27
train
tfhub_cache_dir
Returns cache directory. Returns cache directory from either TFHUB_CACHE_DIR environment variable or --tfhub_cache_dir or default, if set. Args: default_cache_dir: Default cache location to use if neither TFHUB_CACHE_DIR environment variable nor --tfhub_cache_dir are ...
tensorflow_hub/resolver.py
def tfhub_cache_dir(default_cache_dir=None, use_temp=False): """Returns cache directory. Returns cache directory from either TFHUB_CACHE_DIR environment variable or --tfhub_cache_dir or default, if set. Args: default_cache_dir: Default cache location to use if neither TFHUB_CACHE_DIR ...
def tfhub_cache_dir(default_cache_dir=None, use_temp=False): """Returns cache directory. Returns cache directory from either TFHUB_CACHE_DIR environment variable or --tfhub_cache_dir or default, if set. Args: default_cache_dir: Default cache location to use if neither TFHUB_CACHE_DIR ...
[ "Returns", "cache", "directory", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L50-L80
[ "def", "tfhub_cache_dir", "(", "default_cache_dir", "=", "None", ",", "use_temp", "=", "False", ")", ":", "# Note: We are using FLAGS[\"tfhub_cache_dir\"] (and not FLAGS.tfhub_cache_dir)", "# to access the flag value in order to avoid parsing argv list. The flags", "# should have been pa...
09f45963f6787322967b6fec61459f3ac56fbb27
train
create_local_module_dir
Creates and returns the name of directory where to cache a module.
tensorflow_hub/resolver.py
def create_local_module_dir(cache_dir, module_name): """Creates and returns the name of directory where to cache a module.""" tf_v1.gfile.MakeDirs(cache_dir) return os.path.join(cache_dir, module_name)
def create_local_module_dir(cache_dir, module_name): """Creates and returns the name of directory where to cache a module.""" tf_v1.gfile.MakeDirs(cache_dir) return os.path.join(cache_dir, module_name)
[ "Creates", "and", "returns", "the", "name", "of", "directory", "where", "to", "cache", "a", "module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L83-L86
[ "def", "create_local_module_dir", "(", "cache_dir", ",", "module_name", ")", ":", "tf_v1", ".", "gfile", ".", "MakeDirs", "(", "cache_dir", ")", "return", "os", ".", "path", ".", "join", "(", "cache_dir", ",", "module_name", ")" ]
09f45963f6787322967b6fec61459f3ac56fbb27
train
_merge_relative_path
Merge a relative tar file to a destination (which can be "gs://...").
tensorflow_hub/resolver.py
def _merge_relative_path(dst_path, rel_path): """Merge a relative tar file to a destination (which can be "gs://...").""" # Convert rel_path to be relative and normalize it to remove ".", "..", "//", # which are valid directories in fileystems like "gs://". norm_rel_path = os.path.normpath(rel_path.lstrip("/"))...
def _merge_relative_path(dst_path, rel_path): """Merge a relative tar file to a destination (which can be "gs://...").""" # Convert rel_path to be relative and normalize it to remove ".", "..", "//", # which are valid directories in fileystems like "gs://". norm_rel_path = os.path.normpath(rel_path.lstrip("/"))...
[ "Merge", "a", "relative", "tar", "file", "to", "a", "destination", "(", "which", "can", "be", "gs", ":", "//", "...", ")", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L192-L211
[ "def", "_merge_relative_path", "(", "dst_path", ",", "rel_path", ")", ":", "# Convert rel_path to be relative and normalize it to remove \".\", \"..\", \"//\",", "# which are valid directories in fileystems like \"gs://\".", "norm_rel_path", "=", "os", ".", "path", ".", "normpath", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_write_module_descriptor_file
Writes a descriptor file about the directory containing a module. Args: handle: Module name/handle. module_dir: Directory where a module was downloaded.
tensorflow_hub/resolver.py
def _write_module_descriptor_file(handle, module_dir): """Writes a descriptor file about the directory containing a module. Args: handle: Module name/handle. module_dir: Directory where a module was downloaded. """ readme = _module_descriptor_file(module_dir) readme_content = ( "Module: %s\nDow...
def _write_module_descriptor_file(handle, module_dir): """Writes a descriptor file about the directory containing a module. Args: handle: Module name/handle. module_dir: Directory where a module was downloaded. """ readme = _module_descriptor_file(module_dir) readme_content = ( "Module: %s\nDow...
[ "Writes", "a", "descriptor", "file", "about", "the", "directory", "containing", "a", "module", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L219-L234
[ "def", "_write_module_descriptor_file", "(", "handle", ",", "module_dir", ")", ":", "readme", "=", "_module_descriptor_file", "(", "module_dir", ")", "readme_content", "=", "(", "\"Module: %s\\nDownload Time: %s\\nDownloader Hostname: %s (PID:%d)\"", "%", "(", "handle", ","...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_dir_size
Returns total size (in bytes) of the given 'directory'.
tensorflow_hub/resolver.py
def _dir_size(directory): """Returns total size (in bytes) of the given 'directory'.""" size = 0 for elem in tf_v1.gfile.ListDirectory(directory): elem_full_path = os.path.join(directory, elem) stat = tf_v1.gfile.Stat(elem_full_path) size += _dir_size(elem_full_path) if stat.is_directory else stat.len...
def _dir_size(directory): """Returns total size (in bytes) of the given 'directory'.""" size = 0 for elem in tf_v1.gfile.ListDirectory(directory): elem_full_path = os.path.join(directory, elem) stat = tf_v1.gfile.Stat(elem_full_path) size += _dir_size(elem_full_path) if stat.is_directory else stat.len...
[ "Returns", "total", "size", "(", "in", "bytes", ")", "of", "the", "given", "directory", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L273-L280
[ "def", "_dir_size", "(", "directory", ")", ":", "size", "=", "0", "for", "elem", "in", "tf_v1", ".", "gfile", ".", "ListDirectory", "(", "directory", ")", ":", "elem_full_path", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "elem", ")", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_locked_tmp_dir_size
Returns the size of the temp dir pointed to by the given lock file.
tensorflow_hub/resolver.py
def _locked_tmp_dir_size(lock_filename): """Returns the size of the temp dir pointed to by the given lock file.""" task_uid = _task_uid_from_lock_file(lock_filename) try: return _dir_size( _temp_download_dir(_module_dir(lock_filename), task_uid)) except tf.errors.NotFoundError: return 0
def _locked_tmp_dir_size(lock_filename): """Returns the size of the temp dir pointed to by the given lock file.""" task_uid = _task_uid_from_lock_file(lock_filename) try: return _dir_size( _temp_download_dir(_module_dir(lock_filename), task_uid)) except tf.errors.NotFoundError: return 0
[ "Returns", "the", "size", "of", "the", "temp", "dir", "pointed", "to", "by", "the", "given", "lock", "file", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L283-L290
[ "def", "_locked_tmp_dir_size", "(", "lock_filename", ")", ":", "task_uid", "=", "_task_uid_from_lock_file", "(", "lock_filename", ")", "try", ":", "return", "_dir_size", "(", "_temp_download_dir", "(", "_module_dir", "(", "lock_filename", ")", ",", "task_uid", ")", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
_wait_for_lock_to_disappear
Waits for the lock file to disappear. The lock file was created by another process that is performing a download into its own temporary directory. The name of this temp directory is sha1(<module>).<uuid>.tmp where <uuid> comes from the lock file. Args: handle: The location from where a module is being dow...
tensorflow_hub/resolver.py
def _wait_for_lock_to_disappear(handle, lock_file, lock_file_timeout_sec): """Waits for the lock file to disappear. The lock file was created by another process that is performing a download into its own temporary directory. The name of this temp directory is sha1(<module>).<uuid>.tmp where <uuid> comes from t...
def _wait_for_lock_to_disappear(handle, lock_file, lock_file_timeout_sec): """Waits for the lock file to disappear. The lock file was created by another process that is performing a download into its own temporary directory. The name of this temp directory is sha1(<module>).<uuid>.tmp where <uuid> comes from t...
[ "Waits", "for", "the", "lock", "file", "to", "disappear", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L293-L342
[ "def", "_wait_for_lock_to_disappear", "(", "handle", ",", "lock_file", ",", "lock_file_timeout_sec", ")", ":", "locked_tmp_dir_size", "=", "0", "locked_tmp_dir_size_check_time", "=", "time", ".", "time", "(", ")", "lock_file_content", "=", "None", "while", "tf_v1", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
atomic_download
Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function that actually performs download. The callback receives two arguments, handle and the location of a temporary directory ...
tensorflow_hub/resolver.py
def atomic_download(handle, download_fn, module_dir, lock_file_timeout_sec=10 * 60): """Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function tha...
def atomic_download(handle, download_fn, module_dir, lock_file_timeout_sec=10 * 60): """Returns the path to a Module directory for a given TF-Hub Module handle. Args: handle: (string) Location of a TF-Hub Module. download_fn: Callback function tha...
[ "Returns", "the", "path", "to", "a", "Module", "directory", "for", "a", "given", "TF", "-", "Hub", "Module", "handle", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L345-L434
[ "def", "atomic_download", "(", "handle", ",", "download_fn", ",", "module_dir", ",", "lock_file_timeout_sec", "=", "10", "*", "60", ")", ":", "lock_file", "=", "_lock_filename", "(", "module_dir", ")", "task_uid", "=", "uuid", ".", "uuid4", "(", ")", ".", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
DownloadManager._print_download_progress_msg
Prints a message about download progress either to the console or TF log. Args: msg: Message to print. flush: Indicates whether to flush the output (only used in interactive mode).
tensorflow_hub/resolver.py
def _print_download_progress_msg(self, msg, flush=False): """Prints a message about download progress either to the console or TF log. Args: msg: Message to print. flush: Indicates whether to flush the output (only used in interactive mode). """ if self._interactive_mode(): ...
def _print_download_progress_msg(self, msg, flush=False): """Prints a message about download progress either to the console or TF log. Args: msg: Message to print. flush: Indicates whether to flush the output (only used in interactive mode). """ if self._interactive_mode(): ...
[ "Prints", "a", "message", "about", "download", "progress", "either", "to", "the", "console", "or", "TF", "log", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L103-L122
[ "def", "_print_download_progress_msg", "(", "self", ",", "msg", ",", "flush", "=", "False", ")", ":", "if", "self", ".", "_interactive_mode", "(", ")", ":", "# Print progress message to console overwriting previous progress", "# message.", "self", ".", "_max_prog_str", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
DownloadManager._log_progress
Logs progress information about ongoing module download. Args: bytes_downloaded: Number of bytes downloaded.
tensorflow_hub/resolver.py
def _log_progress(self, bytes_downloaded): """Logs progress information about ongoing module download. Args: bytes_downloaded: Number of bytes downloaded. """ self._total_bytes_downloaded += bytes_downloaded now = time.time() if (self._interactive_mode() or now - self._last_progre...
def _log_progress(self, bytes_downloaded): """Logs progress information about ongoing module download. Args: bytes_downloaded: Number of bytes downloaded. """ self._total_bytes_downloaded += bytes_downloaded now = time.time() if (self._interactive_mode() or now - self._last_progre...
[ "Logs", "progress", "information", "about", "ongoing", "module", "download", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L124-L140
[ "def", "_log_progress", "(", "self", ",", "bytes_downloaded", ")", ":", "self", ".", "_total_bytes_downloaded", "+=", "bytes_downloaded", "now", "=", "time", ".", "time", "(", ")", "if", "(", "self", ".", "_interactive_mode", "(", ")", "or", "now", "-", "s...
09f45963f6787322967b6fec61459f3ac56fbb27
train
DownloadManager._extract_file
Extracts 'tarinfo' from 'tgz' and writes to 'dst_path'.
tensorflow_hub/resolver.py
def _extract_file(self, tgz, tarinfo, dst_path, buffer_size=10<<20): """Extracts 'tarinfo' from 'tgz' and writes to 'dst_path'.""" src = tgz.extractfile(tarinfo) dst = tf_v1.gfile.GFile(dst_path, "wb") while 1: buf = src.read(buffer_size) if not buf: break dst.write(buf) ...
def _extract_file(self, tgz, tarinfo, dst_path, buffer_size=10<<20): """Extracts 'tarinfo' from 'tgz' and writes to 'dst_path'.""" src = tgz.extractfile(tarinfo) dst = tf_v1.gfile.GFile(dst_path, "wb") while 1: buf = src.read(buffer_size) if not buf: break dst.write(buf) ...
[ "Extracts", "tarinfo", "from", "tgz", "and", "writes", "to", "dst_path", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L146-L157
[ "def", "_extract_file", "(", "self", ",", "tgz", ",", "tarinfo", ",", "dst_path", ",", "buffer_size", "=", "10", "<<", "20", ")", ":", "src", "=", "tgz", ".", "extractfile", "(", "tarinfo", ")", "dst", "=", "tf_v1", ".", "gfile", ".", "GFile", "(", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
DownloadManager.download_and_uncompress
Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unknown object encountered inside the TAR file.
tensorflow_hub/resolver.py
def download_and_uncompress(self, fileobj, dst_path): """Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unkn...
def download_and_uncompress(self, fileobj, dst_path): """Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unkn...
[ "Streams", "the", "content", "for", "the", "fileobj", "and", "stores", "the", "result", "in", "dst_path", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L159-L189
[ "def", "download_and_uncompress", "(", "self", ",", "fileobj", ",", "dst_path", ")", ":", "try", ":", "with", "tarfile", ".", "open", "(", "mode", "=", "\"r|*\"", ",", "fileobj", "=", "fileobj", ")", "as", "tgz", ":", "for", "tarinfo", "in", "tgz", ":"...
09f45963f6787322967b6fec61459f3ac56fbb27
train
prepend_name_scope
Prepends name scope to a name.
tensorflow_hub/meta_graph_lib.py
def prepend_name_scope(name, import_scope): """Prepends name scope to a name.""" # Based on tensorflow/python/framework/ops.py implementation. if import_scope: try: str_to_replace = r"([\^]|loc:@|^)(.*)" return re.sub(str_to_replace, r"\1" + import_scope + r"/\2", tf.compat.as_...
def prepend_name_scope(name, import_scope): """Prepends name scope to a name.""" # Based on tensorflow/python/framework/ops.py implementation. if import_scope: try: str_to_replace = r"([\^]|loc:@|^)(.*)" return re.sub(str_to_replace, r"\1" + import_scope + r"/\2", tf.compat.as_...
[ "Prepends", "name", "scope", "to", "a", "name", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/meta_graph_lib.py#L32-L45
[ "def", "prepend_name_scope", "(", "name", ",", "import_scope", ")", ":", "# Based on tensorflow/python/framework/ops.py implementation.", "if", "import_scope", ":", "try", ":", "str_to_replace", "=", "r\"([\\^]|loc:@|^)(.*)\"", "return", "re", ".", "sub", "(", "str_to_rep...
09f45963f6787322967b6fec61459f3ac56fbb27
train
prefix_shared_name_attributes
In-place prefixes shared_name attributes of nodes.
tensorflow_hub/meta_graph_lib.py
def prefix_shared_name_attributes(meta_graph, absolute_import_scope): """In-place prefixes shared_name attributes of nodes.""" shared_name_attr = "shared_name" for node in meta_graph.graph_def.node: shared_name_value = node.attr.get(shared_name_attr, None) if shared_name_value and shared_name_value.HasFie...
def prefix_shared_name_attributes(meta_graph, absolute_import_scope): """In-place prefixes shared_name attributes of nodes.""" shared_name_attr = "shared_name" for node in meta_graph.graph_def.node: shared_name_value = node.attr.get(shared_name_attr, None) if shared_name_value and shared_name_value.HasFie...
[ "In", "-", "place", "prefixes", "shared_name", "attributes", "of", "nodes", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/meta_graph_lib.py#L48-L57
[ "def", "prefix_shared_name_attributes", "(", "meta_graph", ",", "absolute_import_scope", ")", ":", "shared_name_attr", "=", "\"shared_name\"", "for", "node", "in", "meta_graph", ".", "graph_def", ".", "node", ":", "shared_name_value", "=", "node", ".", "attr", ".", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
mark_backward
Function to propagate backwards in the graph and mark nodes as used. Traverses recursively through the graph from the end tensor, through the op that generates the tensor, and then to the input tensors that feed the op. Nodes encountered are stored in used_node_names. Args: output_tensor: A Tensor which w...
tensorflow_hub/meta_graph_lib.py
def mark_backward(output_tensor, used_node_names): """Function to propagate backwards in the graph and mark nodes as used. Traverses recursively through the graph from the end tensor, through the op that generates the tensor, and then to the input tensors that feed the op. Nodes encountered are stored in used_...
def mark_backward(output_tensor, used_node_names): """Function to propagate backwards in the graph and mark nodes as used. Traverses recursively through the graph from the end tensor, through the op that generates the tensor, and then to the input tensors that feed the op. Nodes encountered are stored in used_...
[ "Function", "to", "propagate", "backwards", "in", "the", "graph", "and", "mark", "nodes", "as", "used", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/meta_graph_lib.py#L60-L81
[ "def", "mark_backward", "(", "output_tensor", ",", "used_node_names", ")", ":", "op", "=", "output_tensor", ".", "op", "if", "op", ".", "name", "in", "used_node_names", ":", "return", "used_node_names", ".", "add", "(", "op", ".", "name", ")", "for", "inpu...
09f45963f6787322967b6fec61459f3ac56fbb27
train
prune_unused_nodes
Function to prune unused ops given a signature def. This function does a graph traversal through from all outputs as defined in the signature_def to collect all used nodes. Then, any nodes which are unused can be discarded. This is useful for graph which are executing eagerly or on TPUs. Args: meta_grap...
tensorflow_hub/meta_graph_lib.py
def prune_unused_nodes(meta_graph, signature_def): """Function to prune unused ops given a signature def. This function does a graph traversal through from all outputs as defined in the signature_def to collect all used nodes. Then, any nodes which are unused can be discarded. This is useful for graph which ar...
def prune_unused_nodes(meta_graph, signature_def): """Function to prune unused ops given a signature def. This function does a graph traversal through from all outputs as defined in the signature_def to collect all used nodes. Then, any nodes which are unused can be discarded. This is useful for graph which ar...
[ "Function", "to", "prune", "unused", "ops", "given", "a", "signature", "def", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/meta_graph_lib.py#L84-L118
[ "def", "prune_unused_nodes", "(", "meta_graph", ",", "signature_def", ")", ":", "# Instantiate a temporary empty graph so that we have access to Graph API", "# and import the meta_graph.", "graph", "=", "tf_v1", ".", "Graph", "(", ")", "with", "graph", ".", "as_default", "(...
09f45963f6787322967b6fec61459f3ac56fbb27
train
prune_feed_map
Function to prune the feedmap of nodes which no longer exist.
tensorflow_hub/meta_graph_lib.py
def prune_feed_map(meta_graph, feed_map): """Function to prune the feedmap of nodes which no longer exist.""" node_names = [x.name + ":0" for x in meta_graph.graph_def.node] keys_to_delete = [] for k, _ in feed_map.items(): if k not in node_names: keys_to_delete.append(k) for k in keys_to_delete: ...
def prune_feed_map(meta_graph, feed_map): """Function to prune the feedmap of nodes which no longer exist.""" node_names = [x.name + ":0" for x in meta_graph.graph_def.node] keys_to_delete = [] for k, _ in feed_map.items(): if k not in node_names: keys_to_delete.append(k) for k in keys_to_delete: ...
[ "Function", "to", "prune", "the", "feedmap", "of", "nodes", "which", "no", "longer", "exist", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/meta_graph_lib.py#L121-L129
[ "def", "prune_feed_map", "(", "meta_graph", ",", "feed_map", ")", ":", "node_names", "=", "[", "x", ".", "name", "+", "\":0\"", "for", "x", "in", "meta_graph", ".", "graph_def", ".", "node", "]", "keys_to_delete", "=", "[", "]", "for", "k", ",", "_", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
atomic_write_string_to_file
Writes to `filename` atomically. This means that when `filename` appears in the filesystem, it will contain all of `contents`. With write_string_to_file, it is possible for the file to appear in the filesystem with `contents` only partially written. Accomplished by writing to a temp file and then renaming it....
tensorflow_hub/tf_utils.py
def atomic_write_string_to_file(filename, contents, overwrite): """Writes to `filename` atomically. This means that when `filename` appears in the filesystem, it will contain all of `contents`. With write_string_to_file, it is possible for the file to appear in the filesystem with `contents` only partially wri...
def atomic_write_string_to_file(filename, contents, overwrite): """Writes to `filename` atomically. This means that when `filename` appears in the filesystem, it will contain all of `contents`. With write_string_to_file, it is possible for the file to appear in the filesystem with `contents` only partially wri...
[ "Writes", "to", "filename", "atomically", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/tf_utils.py#L40-L64
[ "def", "atomic_write_string_to_file", "(", "filename", ",", "contents", ",", "overwrite", ")", ":", "temp_pathname", "=", "(", "tf", ".", "compat", ".", "as_bytes", "(", "filename", ")", "+", "tf", ".", "compat", ".", "as_bytes", "(", "\".tmp\"", ")", "+",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
get_timestamped_export_dir
Builds a path to a new subdirectory within the base directory. Each export is written into a new subdirectory named using the current time. This guarantees monotonically increasing version numbers even across multiple runs of the pipeline. The timestamp used is the number of seconds since epoch UTC. Args: ...
tensorflow_hub/tf_utils.py
def get_timestamped_export_dir(export_dir_base): """Builds a path to a new subdirectory within the base directory. Each export is written into a new subdirectory named using the current time. This guarantees monotonically increasing version numbers even across multiple runs of the pipeline. The timestamp us...
def get_timestamped_export_dir(export_dir_base): """Builds a path to a new subdirectory within the base directory. Each export is written into a new subdirectory named using the current time. This guarantees monotonically increasing version numbers even across multiple runs of the pipeline. The timestamp us...
[ "Builds", "a", "path", "to", "a", "new", "subdirectory", "within", "the", "base", "directory", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/tf_utils.py#L74-L110
[ "def", "get_timestamped_export_dir", "(", "export_dir_base", ")", ":", "attempts", "=", "0", "while", "attempts", "<", "MAX_DIRECTORY_CREATION_ATTEMPTS", ":", "export_timestamp", "=", "int", "(", "time", ".", "time", "(", ")", ")", "export_dir", "=", "os", ".", ...
09f45963f6787322967b6fec61459f3ac56fbb27
train
get_temp_export_dir
Builds a directory name based on the argument but starting with 'temp-'. This relies on the fact that TensorFlow Serving ignores subdirectories of the base directory that can't be parsed as integers. Args: timestamped_export_dir: the name of the eventual export directory, e.g. /foo/bar/<timestamp> ...
tensorflow_hub/tf_utils.py
def get_temp_export_dir(timestamped_export_dir): """Builds a directory name based on the argument but starting with 'temp-'. This relies on the fact that TensorFlow Serving ignores subdirectories of the base directory that can't be parsed as integers. Args: timestamped_export_dir: the name of the eventual...
def get_temp_export_dir(timestamped_export_dir): """Builds a directory name based on the argument but starting with 'temp-'. This relies on the fact that TensorFlow Serving ignores subdirectories of the base directory that can't be parsed as integers. Args: timestamped_export_dir: the name of the eventual...
[ "Builds", "a", "directory", "name", "based", "on", "the", "argument", "but", "starting", "with", "temp", "-", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/tf_utils.py#L113-L130
[ "def", "get_temp_export_dir", "(", "timestamped_export_dir", ")", ":", "(", "dirname", ",", "basename", ")", "=", "os", ".", "path", ".", "split", "(", "timestamped_export_dir", ")", "temp_export_dir", "=", "os", ".", "path", ".", "join", "(", "tf", ".", "...
09f45963f6787322967b6fec61459f3ac56fbb27
train
garbage_collect_exports
Deletes older exports, retaining only a given number of the most recent. Export subdirectories are assumed to be named with monotonically increasing integers; the most recent are taken to be those with the largest values. Args: export_dir_base: the base directory under which each export is in a versio...
tensorflow_hub/tf_utils.py
def garbage_collect_exports(export_dir_base, exports_to_keep): """Deletes older exports, retaining only a given number of the most recent. Export subdirectories are assumed to be named with monotonically increasing integers; the most recent are taken to be those with the largest values. Args: export_dir_b...
def garbage_collect_exports(export_dir_base, exports_to_keep): """Deletes older exports, retaining only a given number of the most recent. Export subdirectories are assumed to be named with monotonically increasing integers; the most recent are taken to be those with the largest values. Args: export_dir_b...
[ "Deletes", "older", "exports", "retaining", "only", "a", "given", "number", "of", "the", "most", "recent", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/tf_utils.py#L135-L162
[ "def", "garbage_collect_exports", "(", "export_dir_base", ",", "exports_to_keep", ")", ":", "if", "exports_to_keep", "is", "None", ":", "return", "version_paths", "=", "[", "]", "# List of tuples (version, path)", "for", "filename", "in", "tf_v1", ".", "gfile", ".",...
09f45963f6787322967b6fec61459f3ac56fbb27
train
bytes_to_readable_str
Generate a human-readable string representing number of bytes. The units B, kB, MB and GB are used. Args: num_bytes: (`int` or None) Number of bytes. include_b: (`bool`) Include the letter B at the end of the unit. Returns: (`str`) A string representing the number of bytes in a human-readable way, ...
tensorflow_hub/tf_utils.py
def bytes_to_readable_str(num_bytes, include_b=False): """Generate a human-readable string representing number of bytes. The units B, kB, MB and GB are used. Args: num_bytes: (`int` or None) Number of bytes. include_b: (`bool`) Include the letter B at the end of the unit. Returns: (`str`) A strin...
def bytes_to_readable_str(num_bytes, include_b=False): """Generate a human-readable string representing number of bytes. The units B, kB, MB and GB are used. Args: num_bytes: (`int` or None) Number of bytes. include_b: (`bool`) Include the letter B at the end of the unit. Returns: (`str`) A strin...
[ "Generate", "a", "human", "-", "readable", "string", "representing", "number", "of", "bytes", "." ]
tensorflow/hub
python
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/tf_utils.py#L165-L192
[ "def", "bytes_to_readable_str", "(", "num_bytes", ",", "include_b", "=", "False", ")", ":", "if", "num_bytes", "is", "None", ":", "return", "str", "(", "num_bytes", ")", "if", "num_bytes", "<", "1024", ":", "result", "=", "\"%d\"", "%", "num_bytes", "elif"...
09f45963f6787322967b6fec61459f3ac56fbb27
train
announce
Generates a new release announcement entry in the docs.
scripts/release.py
def announce(version): """Generates a new release announcement entry in the docs.""" # Get our list of authors stdout = check_output(["git", "describe", "--abbrev=0", "--tags"]) stdout = stdout.decode("utf-8") last_version = stdout.strip() stdout = check_output( ["git", "log", "{}..HEAD...
def announce(version): """Generates a new release announcement entry in the docs.""" # Get our list of authors stdout = check_output(["git", "describe", "--abbrev=0", "--tags"]) stdout = stdout.decode("utf-8") last_version = stdout.strip() stdout = check_output( ["git", "log", "{}..HEAD...
[ "Generates", "a", "new", "release", "announcement", "entry", "in", "the", "docs", "." ]
pytest-dev/pytest
python
https://github.com/pytest-dev/pytest/blob/204004c8b8b743110a5f12f2bfa31154e0f59815/scripts/release.py#L14-L65
[ "def", "announce", "(", "version", ")", ":", "# Get our list of authors", "stdout", "=", "check_output", "(", "[", "\"git\"", ",", "\"describe\"", ",", "\"--abbrev=0\"", ",", "\"--tags\"", "]", ")", "stdout", "=", "stdout", ".", "decode", "(", "\"utf-8\"", ")"...
204004c8b8b743110a5f12f2bfa31154e0f59815
train
pre_release
Generates new docs, release announcements and creates a local tag.
scripts/release.py
def pre_release(version): """Generates new docs, release announcements and creates a local tag.""" announce(version) regen() changelog(version, write_out=True) fix_formatting() msg = "Preparing release version {}".format(version) check_call(["git", "commit", "-a", "-m", msg]) print() ...
def pre_release(version): """Generates new docs, release announcements and creates a local tag.""" announce(version) regen() changelog(version, write_out=True) fix_formatting() msg = "Preparing release version {}".format(version) check_call(["git", "commit", "-a", "-m", msg]) print() ...
[ "Generates", "new", "docs", "release", "announcements", "and", "creates", "a", "local", "tag", "." ]
pytest-dev/pytest
python
https://github.com/pytest-dev/pytest/blob/204004c8b8b743110a5f12f2bfa31154e0f59815/scripts/release.py#L82-L95
[ "def", "pre_release", "(", "version", ")", ":", "announce", "(", "version", ")", "regen", "(", ")", "changelog", "(", "version", ",", "write_out", "=", "True", ")", "fix_formatting", "(", ")", "msg", "=", "\"Preparing release version {}\"", ".", "format", "(...
204004c8b8b743110a5f12f2bfa31154e0f59815
train
dump
A basic wrapper around Pickle to serialize a list of prediction and/or an algorithm on drive. What is dumped is a dictionary with keys ``'predictions'`` and ``'algo'``. Args: file_name(str): The name (with full path) specifying where to dump the predictions. predictions(list of...
surprise/dump.py
def dump(file_name, predictions=None, algo=None, verbose=0): """A basic wrapper around Pickle to serialize a list of prediction and/or an algorithm on drive. What is dumped is a dictionary with keys ``'predictions'`` and ``'algo'``. Args: file_name(str): The name (with full path) specifying wh...
def dump(file_name, predictions=None, algo=None, verbose=0): """A basic wrapper around Pickle to serialize a list of prediction and/or an algorithm on drive. What is dumped is a dictionary with keys ``'predictions'`` and ``'algo'``. Args: file_name(str): The name (with full path) specifying wh...
[ "A", "basic", "wrapper", "around", "Pickle", "to", "serialize", "a", "list", "of", "prediction", "and", "/", "or", "an", "algorithm", "on", "drive", "." ]
NicolasHug/Surprise
python
https://github.com/NicolasHug/Surprise/blob/2efa8840ac2719050178d836c1d6904f9431f3c6/surprise/dump.py#L8-L34
[ "def", "dump", "(", "file_name", ",", "predictions", "=", "None", ",", "algo", "=", "None", ",", "verbose", "=", "0", ")", ":", "dump_obj", "=", "{", "'predictions'", ":", "predictions", ",", "'algo'", ":", "algo", "}", "pickle", ".", "dump", "(", "d...
2efa8840ac2719050178d836c1d6904f9431f3c6
train
AutoscalingV2beta1Api.delete_namespaced_horizontal_pod_autoscaler
delete a HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_namespaced_horizontal_pod_autoscaler(name, namespace, async_req=True) >>> result = thread.get() :par...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def delete_namespaced_horizontal_pod_autoscaler(self, name, namespace, **kwargs): """ delete a HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_namespaced_hori...
def delete_namespaced_horizontal_pod_autoscaler(self, name, namespace, **kwargs): """ delete a HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_namespaced_hori...
[ "delete", "a", "HorizontalPodAutoscaler", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", "....
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L281-L307
[ "def", "delete_namespaced_horizontal_pod_autoscaler", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return"...
5e512ff564c244c50cab780d821542ed56aa965a
train
AutoscalingV2beta1Api.get_api_resources
get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_api_resources(async_req=True) >>> result = thread.get() :param async_req bool :return: V1APIResourceList...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def get_api_resources(self, **kwargs): """ get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_api_resources(async_req=True) >>> result = thread.get() ...
def get_api_resources(self, **kwargs): """ get available resources This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_api_resources(async_req=True) >>> result = thread.get() ...
[ "get", "available", "resources", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", ".", "get...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L408-L426
[ "def", "get_api_resources", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "get_api_resources_with_http_info", "(", ...
5e512ff564c244c50cab780d821542ed56aa965a
train
AutoscalingV2beta1Api.patch_namespaced_horizontal_pod_autoscaler
partially update the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_horizontal_pod_autoscaler(name, namespace, body, async_req=True) >>> result =...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def patch_namespaced_horizontal_pod_autoscaler(self, name, namespace, body, **kwargs): """ partially update the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread =...
def patch_namespaced_horizontal_pod_autoscaler(self, name, namespace, body, **kwargs): """ partially update the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread =...
[ "partially", "update", "the", "specified", "HorizontalPodAutoscaler", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", ...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L745-L770
[ "def", "patch_namespaced_horizontal_pod_autoscaler", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ...
5e512ff564c244c50cab780d821542ed56aa965a
train
AutoscalingV2beta1Api.patch_namespaced_horizontal_pod_autoscaler_status
partially update status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_namespaced_horizontal_pod_autoscaler_status(name, namespace, body, async_req=True) ...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def patch_namespaced_horizontal_pod_autoscaler_status(self, name, namespace, body, **kwargs): """ partially update status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
def patch_namespaced_horizontal_pod_autoscaler_status(self, name, namespace, body, **kwargs): """ partially update status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
[ "partially", "update", "status", "of", "the", "specified", "HorizontalPodAutoscaler", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=",...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L871-L896
[ "def", "patch_namespaced_horizontal_pod_autoscaler_status", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ...
5e512ff564c244c50cab780d821542ed56aa965a
train
AutoscalingV2beta1Api.replace_namespaced_horizontal_pod_autoscaler
replace the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_horizontal_pod_autoscaler(name, namespace, body, async_req=True) >>> result = thread...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def replace_namespaced_horizontal_pod_autoscaler(self, name, namespace, body, **kwargs): """ replace the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.re...
def replace_namespaced_horizontal_pod_autoscaler(self, name, namespace, body, **kwargs): """ replace the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.re...
[ "replace", "the", "specified", "HorizontalPodAutoscaler", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", ...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L1219-L1243
[ "def", "replace_namespaced_horizontal_pod_autoscaler", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")",...
5e512ff564c244c50cab780d821542ed56aa965a
train
AutoscalingV2beta1Api.replace_namespaced_horizontal_pod_autoscaler_status
replace status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_horizontal_pod_autoscaler_status(name, namespace, body, async_req=True) >>...
kubernetes/client/apis/autoscaling_v2beta1_api.py
def replace_namespaced_horizontal_pod_autoscaler_status(self, name, namespace, body, **kwargs): """ replace status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>...
def replace_namespaced_horizontal_pod_autoscaler_status(self, name, namespace, body, **kwargs): """ replace status of the specified HorizontalPodAutoscaler This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>...
[ "replace", "status", "of", "the", "specified", "HorizontalPodAutoscaler", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", "...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/autoscaling_v2beta1_api.py#L1341-L1365
[ "def", "replace_namespaced_horizontal_pod_autoscaler_status", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'",...
5e512ff564c244c50cab780d821542ed56aa965a
train
V1alpha1WebhookClientConfig.ca_bundle
Sets the ca_bundle of this V1alpha1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. :param ca_bundle: The ca_bundle of this V1alpha1WebhookClientConfig. :type...
kubernetes/client/models/v1alpha1_webhook_client_config.py
def ca_bundle(self, ca_bundle): """ Sets the ca_bundle of this V1alpha1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. :param ca_bundle: The ca_bundl...
def ca_bundle(self, ca_bundle): """ Sets the ca_bundle of this V1alpha1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. :param ca_bundle: The ca_bundl...
[ "Sets", "the", "ca_bundle", "of", "this", "V1alpha1WebhookClientConfig", ".", "caBundle", "is", "a", "PEM", "encoded", "CA", "bundle", "which", "will", "be", "used", "to", "validate", "the", "webhook", "s", "server", "certificate", ".", "If", "unspecified", "s...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/models/v1alpha1_webhook_client_config.py#L74-L85
[ "def", "ca_bundle", "(", "self", ",", "ca_bundle", ")", ":", "if", "ca_bundle", "is", "not", "None", "and", "not", "re", ".", "search", "(", "'^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$'", ",", "ca_bundle", ")", ":", "raise", "ValueError"...
5e512ff564c244c50cab780d821542ed56aa965a
train
SettingsV1alpha1Api.create_namespaced_pod_preset
create a PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_pod_preset(namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :pa...
kubernetes/client/apis/settings_v1alpha1_api.py
def create_namespaced_pod_preset(self, namespace, body, **kwargs): """ create a PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_pod_preset(namespace, body, async...
def create_namespaced_pod_preset(self, namespace, body, **kwargs): """ create a PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_pod_preset(namespace, body, async...
[ "create", "a", "PodPreset", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", ".", "create_n...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/settings_v1alpha1_api.py#L38-L61
[ "def", "create_namespaced_pod_preset", "(", "self", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", "...
5e512ff564c244c50cab780d821542ed56aa965a
train
SettingsV1alpha1Api.delete_collection_namespaced_pod_preset
delete collection of PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_pod_preset(namespace, async_req=True) >>> result = thread.get() :param async_req...
kubernetes/client/apis/settings_v1alpha1_api.py
def delete_collection_namespaced_pod_preset(self, namespace, **kwargs): """ delete collection of PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_pod_p...
def delete_collection_namespaced_pod_preset(self, namespace, **kwargs): """ delete collection of PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_pod_p...
[ "delete", "collection", "of", "PodPreset", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", ...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/settings_v1alpha1_api.py#L153-L180
[ "def", "delete_collection_namespaced_pod_preset", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", ...
5e512ff564c244c50cab780d821542ed56aa965a
train
SettingsV1alpha1Api.list_pod_preset_for_all_namespaces
list or watch objects of kind PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_pod_preset_for_all_namespaces(async_req=True) >>> result = thread.get() :param async_req bool ...
kubernetes/client/apis/settings_v1alpha1_api.py
def list_pod_preset_for_all_namespaces(self, **kwargs): """ list or watch objects of kind PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_pod_preset_for_all_namespaces(async_...
def list_pod_preset_for_all_namespaces(self, **kwargs): """ list or watch objects of kind PodPreset This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_pod_preset_for_all_namespaces(async_...
[ "list", "or", "watch", "objects", "of", "kind", "PodPreset", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "th...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/settings_v1alpha1_api.py#L624-L650
[ "def", "list_pod_preset_for_all_namespaces", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_pod_preset_for_all_na...
5e512ff564c244c50cab780d821542ed56aa965a
train
BatchV2alpha1Api.create_namespaced_cron_job
create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param ...
kubernetes/client/apis/batch_v2alpha1_api.py
def create_namespaced_cron_job(self, namespace, body, **kwargs): """ create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=T...
def create_namespaced_cron_job(self, namespace, body, **kwargs): """ create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=T...
[ "create", "a", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", ".", "create_nam...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/batch_v2alpha1_api.py#L38-L61
[ "def", "create_namespaced_cron_job", "(", "self", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", "."...
5e512ff564c244c50cab780d821542ed56aa965a
train
BatchV2alpha1Api.delete_collection_namespaced_cron_job
delete collection of CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_cron_job(namespace, async_req=True) >>> result = thread.get() :param async_req boo...
kubernetes/client/apis/batch_v2alpha1_api.py
def delete_collection_namespaced_cron_job(self, namespace, **kwargs): """ delete collection of CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_cron_job(...
def delete_collection_namespaced_cron_job(self, namespace, **kwargs): """ delete collection of CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_cron_job(...
[ "delete", "collection", "of", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", "...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/batch_v2alpha1_api.py#L153-L180
[ "def", "delete_collection_namespaced_cron_job", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "d...
5e512ff564c244c50cab780d821542ed56aa965a
train
BatchV2alpha1Api.list_cron_job_for_all_namespaces
list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cron_job_for_all_namespaces(async_req=True) >>> result = thread.get() :param async_req bool ...
kubernetes/client/apis/batch_v2alpha1_api.py
def list_cron_job_for_all_namespaces(self, **kwargs): """ list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cron_job_for_all_namespaces(async_req=Tr...
def list_cron_job_for_all_namespaces(self, **kwargs): """ list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cron_job_for_all_namespaces(async_req=Tr...
[ "list", "or", "watch", "objects", "of", "kind", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thre...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/batch_v2alpha1_api.py#L496-L522
[ "def", "list_cron_job_for_all_namespaces", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_cron_job_for_all_namesp...
5e512ff564c244c50cab780d821542ed56aa965a
train
BatchV2alpha1Api.list_namespaced_cron_job
list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_namespaced_cron_job(namespace, async_req=True) >>> result = thread.get() :param async_req bool ...
kubernetes/client/apis/batch_v2alpha1_api.py
def list_namespaced_cron_job(self, namespace, **kwargs): """ list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_namespaced_cron_job(namespace, async_...
def list_namespaced_cron_job(self, namespace, **kwargs): """ list or watch objects of kind CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_namespaced_cron_job(namespace, async_...
[ "list", "or", "watch", "objects", "of", "kind", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thre...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/batch_v2alpha1_api.py#L617-L644
[ "def", "list_namespaced_cron_job", "(", "self", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_namespace...
5e512ff564c244c50cab780d821542ed56aa965a
train
BatchV2alpha1Api.read_namespaced_cron_job
read the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_cron_job(name, namespace, async_req=True) >>> result = thread.get() :param async_req bool ...
kubernetes/client/apis/batch_v2alpha1_api.py
def read_namespaced_cron_job(self, name, namespace, **kwargs): """ read the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_cron_job(name, namespace, async...
def read_namespaced_cron_job(self, name, namespace, **kwargs): """ read the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_cron_job(name, namespace, async...
[ "read", "the", "specified", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>", "thread", "=", "api", "."...
kubernetes-client/python
python
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/batch_v2alpha1_api.py#L997-L1020
[ "def", "read_namespaced_cron_job", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", ...
5e512ff564c244c50cab780d821542ed56aa965a