MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _should_include_node

Function _should_include_node

tensorflow/python/framework/meta_graph.py:348–377  ·  view source on GitHub ↗

Returns `True` if a node should be included. Args: node_or_node_name: A node or `string` node name. export_scope: `string`. Name scope under which to extract the subgraph. The scope name will be stripped from the node definitions for easy import later into new name scopes.

(node_or_node_name, export_scope, exclude_nodes)

Source from the content-addressed store, hash-verified

346
347
348def _should_include_node(node_or_node_name, export_scope, exclude_nodes):
349 """Returns `True` if a node should be included.
350
351 Args:
352 node_or_node_name: A node or `string` node name.
353 export_scope: `string`. Name scope under which to extract the subgraph. The
354 scope name will be stripped from the node definitions for easy import
355 later into new name scopes.
356 exclude_nodes: An iterable of nodes or `string` node names to omit from the
357 export, or None. Note no sanity-checking is done, so this list must be
358 carefully constructed to avoid producing an invalid graph.
359
360 Returns:
361 `True` if the node should be included.
362 """
363 if not isinstance(node_or_node_name, six.string_types):
364 try:
365 node_name = node_or_node_name.name
366 except AttributeError:
367 # Keep the object that we don't know how to process.
368 return True
369 else:
370 node_name = node_or_node_name
371
372 if exclude_nodes and (node_or_node_name in exclude_nodes
373 or node_name in exclude_nodes):
374 return False
375
376 return (node_name.startswith(_UNBOUND_INPUT_PREFIX) or
377 (not export_scope or node_name.startswith(export_scope)))
378
379
380def add_collection_def(meta_graph_def, key, graph=None,

Callers 2

add_collection_defFunction · 0.85
export_scoped_meta_graphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected