afnio.autodiff.graph#
Classes
|
Object representing a given gradient edge within the autodiff graph. |
|
- class afnio.autodiff.graph.GradientEdge(node: Node, output_nr: int)[source]#
Bases:
NamedTupleObject representing a given gradient edge within the autodiff graph.
To get the gradient edge where a given Variable gradient will be computed, you can do
edge = autodiff.graph.get_gradient_edge(variable).- count(value, /)#
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)#
Return first index of value.
Raises ValueError if the value is not present.
- class afnio.autodiff.graph.Node(next_functions=None)[source]#
Bases:
object- name()[source]#
Return the name.
Example:
>>> import afnio >>> import afnio.cognitive.functional as F >>> a = hf.Variable("Hello,", requires_grad=True) >>> b = hf.Variable("world!", requires_grad=True) >>> c = F.sum([a, b]) >>> assert isinstance(c.grad_fn, afnio.autodiff.graph.Node) >>> print(c.grad_fn.name()) SumBackward0
- property next_functions: Tuple[GradientEdge]#