assert (Value(1) + Value(2)).data == (Value(3)).data
assert (Value(1) * Value(2)).data == (Value(2)).data
assert (Value(1) + Value(2) * Value(3)).data == (Value(7)).data
Value
Value
Value (data:float, _children:Tuple[ForwardRef('Value'),...]=(), _op:str='', label:str='')
This is the fundamental building block of our neural nets. This is a class that stores any scalar value and provides various mathamatical operations on it. It also stores the gradient of the value with respect to some scalar value. This is used to compute the gradients of the loss function with respect to the parameters of the neural net.
Type | Default | Details | |
---|---|---|---|
data | float | This stores the value of the node | |
_children | typing.Tuple[ForwardRef(‘Value’), …] | () | |
_op | str | Ths store the value of te operationthat was used to compute the current node. | |
label | str | Each value can have an associated label that can be used to identify it during calling draw_dot |
1, label='a') + Value(2, label='b') * Value(3, label='c')).draw_dot() (Value(