Viewers¶
SimpleGraph¶
-
class
nnabla.experimental.viewers.
SimpleGraph
(format='png', verbose=False, fname_color_map=None, vname_color_map=None)[source]¶ Simple Graph with GraphViz.
Example:
import nnabla as nn import nnabla.functions as F import nnabla.parametric_functions as PF import nnabla.experimental.viewers as V # Model definition def network(image, test=False): h = image h /= 255.0 h = PF.convolution(h, 16, kernel=(3, 3), pad=(1, 1), name="conv") h = PF.batch_normalization(h, name="bn", batch_stat=not test) h = F.relu(h) pred = PF.affine(h, 10, name='fc') return pred # Model image = nn.Variable([4, 3, 32, 32]) pred = network(image, test=False) # Graph Viewer graph = V.SimpleGraph(verbose=False) graph.view(pred) graph.save(pred, "sample_grpah")
-
create_graphviz_digraph
(vleaf, format=None)[source]¶ Create a
graphviz.Digraph
object given the leaf variable of a computation graph.One of nice things of getting
Digraph
directly is that the drawn graph can be displayed inline in a Jupyter notebook as described in Graphviz documentation.- Parameters
vleaf (
nnabla.Variable
) – End variable. All variables and functions which can be traversed from this variable are shown in the reuslt.format (str) – Force overwrite
format
('pdf', 'png', ...)
) configuration.
Returns: graphviz.Digraph
-
save
(vleaf, fpath, cleanup=False, format=None)[source]¶ Save the graph to a given file path.
- Parameters
vleaf (
nnabla.Variable
) – End variable. All variables and functions which can be traversed from this variable are shown in the reuslt.fpath (
str
) – The file path used to save.cleanup (
bool
) – Clean up the source file after rendering. Default is False.format (str) – Force overwrite
format
('pdf', 'png', ...)
) configuration.
-
view
(vleaf, fpath=None, cleanup=True, format=None)[source]¶ View the graph.
- Parameters
vleaf (
nnabla.Variable
) – End variable. All variables and functions which can be traversed from this variable are shown in the reuslt.fpath (
str
) – The file path used to save.cleanup (
bool
) – Clean up the source file after rendering. Default is True.format (str) – Force overwrite
format
('pdf', 'png', ...)
) configuration.
-