Skip to content

Handle True Constants #9

@tomiock

Description

@tomiock

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:

Image

This messes up the operations counters that are used on the graph to assign node labels/IDs: there are two extra `const.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingengineWork the tensor engine for forward and backward

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions