diff --git a/cgp/cartesian_graph.py b/cgp/cartesian_graph.py index afde532e..0c48bbaf 100644 --- a/cgp/cartesian_graph.py +++ b/cgp/cartesian_graph.py @@ -243,7 +243,7 @@ def to_func(self) -> Callable[..., List[float]]: Returns ------- - Callable or Tuple[Callable] + Callable """ self._format_output_str_of_all_nodes() @@ -317,7 +317,8 @@ def to_torch(self) -> "torch.nn.Module": this graph. The generated instance will have a `forward` method accepting - Torch tensor and returning a tensor. + Torch tensor of dimension (, n_inputs) and + returning a tensor of dimension (, n_outputs). Returns ------- @@ -382,9 +383,12 @@ def _format_output_str_sympy_of_all_nodes(self): def to_sympy( self, simplify: Optional[bool] = True ) -> Union["sympy_expr.Expr", List["sympy_expr.Expr"]]: - """Compile the function(s) represented by the graph to a SymPy expression. + """Create SymPy expression(s) representing the function(s) described + by this graph. - Generates one SymPy expression for each output node. + Returns a list of SymPy expressions, one for each output + node. For convenience, if only one output node is defined, it + directly returns its expression. Parameters ---------- @@ -394,8 +398,9 @@ def to_sympy( Returns ---------- - List[sympy.core.expr.Expr] - List of SymPy expressions. + List[sympy.core.expr.Expr] or sympy.core.expr.Expr + List of SymPy expressions or single expression. + """ def possibly_unpack(