Skip to content

Inconsistent representation of parent nodes in unary ops #39

Description

@github-actions

File: leanpass/tensor.py

Unary operations (exp, log, sigmoid, softmax) pass the predecessor as a set {self} to _create_child, while binary ops use a tuple (self, other). The rest of the library (graph traversal, topological sorting, and any(node.requires_grad for node in prev)) expects an ordered iterable. Using a mutable set can lead to nondeterministic ordering and potential errors when the set is later mutated.

Fix: always pass a tuple (e.g., (self,)) for consistency.

Label: bug

Filed automatically by ai-issue-scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions