of function applications. A function can be applied to a node from another funtion's graph; this implicitly creates a nested function. Functions are first-class objects, so returning a nested function creates a closure. """ from typing import (List, Set, Tuple, Any, Sequence, MutableSequence, overload, Iterable) from myia.ir import Node from myia.utils import Named, repr_, list_str from myia.info import NamedDebugInfo from myia.prim import ops as primops PARAMETER = Named('PARAMETER') APPLY = Named('APPLY') LITERALS = (bool, int, str, float) class Graph: """A function graph. Attributes: parameters: The parameters of this function as a list of `Parameter` nodes. Parameter nodes that are unreachable by walking from the output node correspond to unused parameters. return_: The `Apply` node that calls the `Return` primitive. The input to this node will be returned by this function. A graph initially has no output node (because it won't be known e.g. until the
def test_named(): named = Named('foo') assert repr(named) == 'foo'
def test_named(): named = Named("foo") assert repr(named) == "foo"