Currently inside of macrograd.__init__.py:
import numpy as np
from .tensor import Tensor # Make Tensor directly importable from macrograd
__all__ = ["Tensor"] # Optional: Control what gets imported with "from macrograd import *"
e = Tensor(np.e, requires_grad=False)
pi = Tensor(np.pi, requires_grad=False)
This is execute when importing with from macrograd import Tensor. The creation of the constants is also called, the default graph is actually created here, with the constant e:

This messes up the operations counters that are used on the graph to assign node labels/IDs: there are two extra `const.
Currently inside of
macrograd.__init__.py:This is execute when importing with
from macrograd import Tensor. The creation of the constants is also called, the default graph is actually created here, with the constante:This messes up the operations counters that are used on the graph to assign node labels/IDs: there are two extra `const.