The file graph_def_editor/select.py contains various routines for selecting subsets of a graph's nodes and/or tensors.
A few issues with the current organization of this file:
Adds 18 functions to the top-level gde namespace
Entry points are monolithic -- see, for example, select_s()
Return values are not in a single consistent format
No easy way to represent a selection expression as an object
To address the above issues and to facilitate the development of the "pattern" part of pattern-action rewrite rules, we should refactor these functions into a more object-oriented design:
Add a base class, Selector, for selection expressions over a graph. The base class will have methods to:
Get information about what types of things (tensors, nodes, or both) the expression can select
Retrieve the current set of selected graph objects as a Python list
Retrieve the current set of selected objects as a SubgraphView
Make the existing functions return subclasses of Selector
Put existing functions under a new namespace gde.select
Remove unnecessary subroutines from the top-level package
The file
graph_def_editor/select.py
contains various routines for selecting subsets of a graph's nodes and/or tensors.A few issues with the current organization of this file:
gde
namespaceselect_s()
To address the above issues and to facilitate the development of the "pattern" part of pattern-action rewrite rules, we should refactor these functions into a more object-oriented design:
Selector
, for selection expressions over a graph. The base class will have methods to:Selector
gde.select