Coverage for Adifpy/construct/function_tree.py: 60%
10 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-22 19:44 -0500
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-22 19:44 -0500
1"""Implements the computational graph"""
4class TreeNode():
5 """Node for the binary tree below
7 Attributes:
8 value: the intermediate variable
9 left: the root of the left sub-tree
10 right: the root of the right-subtree
11 """
13 def __init__(self, value, left=None, right=None):
14 pass
17class FunctionTree():
18 """A binary tree representing the elementary operations of a function
20 A representation of a computational graph in the form of a tree,
21 where intermediate variables of forward trace are stored as nodes.
22 The parent-child relationship between these nodes represents the elementary
23 operations for these intermediate variables.
24 """
26 def __init__(self):
27 pass
29 def register_operation(self, operation, input_1, input_2=None):
30 """Add the given node to the tree
32 Args:
33 operation: the elementary operation to register
34 input_1: the first intermediate variable that is input to this operation
35 input_2: the second intermediate variable, if the operation is not unary
36 """
37 pass
39 def pass_through(self, value):
40 """Pass a value through the function tree
41 """
42 pass
44 # Other helper functions will be needed as well