Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

algebraic operations for BaseNode #292

Closed

Description

@mganahl

It would be convenient to have addition, subtraction, multiplication by scalar and division by scalar for BaseNodes:

a, b =tn.Node(np.random.rand(3,3)), tn.Node(np.random.rand(3,3))
c=a + b
d = a*10
e = a/5

Activity

  1. added
    enhancement
    good first issue
    on Oct 4, 2019
  2. miriyalavignesh commented on Oct 4, 2019

    @miriyalavignesh

    Hey I want to work on this issue, I am guessing this should be little bit straight forward. Since this is mostly implementing operator overloading for TensorNetwork, please let me know if there are more caveats which are not obvious.

  3. chaserileyroberts commented on Oct 11, 2019

    @chaserileyroberts
    Contributor

    Great! Go for it.

    Yes you'll need to overload the Node classes __add__, __mul__ etc methods and then modifying the underlying tensors based on their backends. I would recommend adding them to the BaseNode class and throwing NotImplemented errors for node types that don't support these types of ops. (For example, CopyNode shouldn't support these operations.)

    You'll then need to add the add, multiply, etc operations to BaseBackend and then add them to the concrete backend classes.

  4. IllgamhoDuck commented on Jan 19, 2020

    @IllgamhoDuck
    Contributor

    @Thenerdstation How is this issue going on? I checked the PR of this issue but seems not merged yet. Seems add, sub is made and mul, div yet can I work on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions