qkeras.qtools.qgraph
Creates networkx graph from a model.
Functions
|
Adds layer to a node_dict, indexed by layer.(input or output).ref |
|
create graph. |
|
Generates single source, single sink graph from model. |
|
Generates the list of input quantizers. |
|
For Keras Sequential model api, input layer is hidden. |
Connects graph to source and sink nodes. |
|
|
Returns edges SOURCE->u that are inputs. |
|
Returns edges u->SINK that are outputs. |
|
Traverses graph and move activations to edges. |
|
Removes node "v" from u -> v -> w, connecting u -> w. |
|
Removes node with attribute node_type, reconnecting network. |
|
update the graph edges outgoing from node_id with new quantizer. |
|
Print graph structure. |
Exceptions
- qkeras.qtools.qgraph.AddToNodeDict(layer_items, layer, nodes_dict)[source]
Adds layer to a node_dict, indexed by layer.(input or output).ref
- qkeras.qtools.qgraph.CreateGraph(model, input_quantizers=None, default_source_quantizer='quantized_bits(8, 0, 1)', debug=False)[source]
create graph.
- qkeras.qtools.qgraph.GenerateGraphFromModel(model, input_quantizers, default_source_quantizer)[source]
Generates single source, single sink graph from model.
- qkeras.qtools.qgraph.GenerateInputQuantizerList(input_quantizers, inputs_length, default_source_quantizer)[source]
Generates the list of input quantizers.
- qkeras.qtools.qgraph.GraphAddHiddenInputLayer(model, graph, input_quantizer_map)[source]
For Keras Sequential model api, input layer is hidden. Need to add it.
- qkeras.qtools.qgraph.GraphAddSingleSourceSingleSink(graph)[source]
Connects graph to source and sink nodes.
- qkeras.qtools.qgraph.GraphPropagateActivationsToEdges(graph, debug=False)[source]
Traverses graph and move activations to edges.
- 1.If current dense/conv layer is specified with QA:
outgoing edge (output data type) will be QA type
- 2.If current dense/conv layer has no QA:
default type (float32) is used as output
- 3.If current layer is QA layer:
float32 is used by default as output type on the edge
- Parameters:
graph – graph to inject activations to.
debug – debug mode
- Returns:
None
- qkeras.qtools.qgraph.GraphRemoveNode(graph, v)[source]
Removes node “v” from u -> v -> w, connecting u -> w.
- qkeras.qtools.qgraph.GraphRemoveNodeWithNodeType(graph, node_type)[source]
Removes node with attribute node_type, reconnecting network.