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.

What to submit for a issue? #423

@IllgamhoDuck

Description

@IllgamhoDuck

def set_name(self, name) -> None:
self.name = name

I'm trying to use the tensor network and testing it right now.
I just found that this line of code doesn't have protection.

So if I do ..

node = tn.Node(np.eye(2))
print(node) # __unnamed_node__
node.set_name(node)
print(node)

Type error occured not when I assign the name and occured when I try to print it out.
Because I sended the node instance to the self.name.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-28-cdce2f239ef3> in <module>
----> 1 print(node)

TypeError: __str__ returned non-string (type Node)

Is this a problem or not? Is this kind of protection needed?

assert type(self.name) == str, "the name should be string type"

I'm not sure about is this could be an issue or not so I just posted a question here.
I tried to look for a guideline but hard to get a sense of the scope of how far I could post or fix.
https://github.com/google/TensorNetwork/blob/master/CONTRIBUTING.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions