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)
| 346 | |
| 347 | |
| 348 | def _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 | |
| 380 | def add_collection_def(meta_graph_def, key, graph=None, |
no outgoing calls
no test coverage detected