chainer.computational_graph.ComputationalGraph¶
-
class
chainer.computational_graph.
ComputationalGraph
(nodes, edges, variable_style={'fillcolor': '#E0E0E0', 'shape': 'octagon', 'style': 'filled'}, function_style={'fillcolor': '#6495ED', 'shape': 'record', 'style': 'filled'}, rankdir='TB', remove_variable=False, show_name=True)[source]¶ Class that represents computational graph.
Note
We assume that the computational graph is directed and acyclic.
- Parameters
nodes (list) – List of nodes. Each node is either
VariableNode
object orFunctionNode
object.edges (list) – List of edges. Each edge consists of pair of nodes.
variable_style (dict) – Dot node style for variable.
function_style (dict) – Dot node style for function.
rankdir (str) – Direction of the graph that must be TB (top to bottom), BT (bottom to top), LR (left to right) or RL (right to left).
remove_variable (bool) – If
True
,VariableNode
s are removed from the resulting computational graph. OnlyFunctionNode
s are shown in the output.show_name (bool) – If
True
, thename
attribute of each node is added to the label of the node. Default isTrue
.
Note
The default behavior of
ComputationalGraph
has been changed from v1.23.0, so that it ouputs the richest representation of a graph as default, namely, styles are set and names of functions and variables are shown. To reproduce the same result as previous versions (<= v1.22.0), please specify variable_style=None, function_style=None, and show_name=False explicitly.Methods