Git Product home page Git Product logo

Comments (13)

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

I think what I'll likely do now is split up tensornetwork.py into node.py, edge.py and network.py.

from tensornetwork.

kshithijiyer avatar kshithijiyer commented on May 3, 2024

@Thenerdstation are you working on this or is it up for grab?

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

We need to move some code from internal first before we break it up. That should be done soon so afterwards go for it.

from tensornetwork.

kshithijiyer avatar kshithijiyer commented on May 3, 2024

Okay. Will wait for your go on this one.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Once #22 is in you should be good to go.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Ok go for it.

Be sure that Node, Edge and TensorNetwork classes are publicly accessible from import tensornetwork

from tensornetwork.

amilsted avatar amilsted commented on May 3, 2024

Hey, thanks for working on this @kshithijiyer. I noticed you still have a tensornetwork.py. Can we make it network.py?

from tensornetwork.

kshithijiyer avatar kshithijiyer commented on May 3, 2024

Splitting the files is hitting a circular import error. Hence what I feel is that splitting the file into 3 files won't be possible but a split into 2 files would be possible.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Yeah I think you are correct. Basically, what happened is it would start to parse node.py and then hit from tensornetwork import edge, continue to parse edge.py until it hit node.Node type declaration and raise an undefined error. This only happens because we use pytype.

Dang that sucks.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

I think we can get around it by using strings for the typing instead of using the module directly.

from tensornetwork.

kshithijiyer avatar kshithijiyer commented on May 3, 2024

I am not sure if that is a proper solution to this. This is what is happening when we split it into 3 files https://stackabuse.com/python-circular-imports/.
I feel a way out would be to have two files:

  1. support.py -> Having classes Node and Edge.
  2. network.py -> TensorNetwork class only

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

So I started working on this and what is frustrating is that the tests pass by pytype doesn't. I'll be sure to raise a bug on that internally.

from tensornetwork.

kshithijiyer avatar kshithijiyer commented on May 3, 2024

@Thenerdstation I think we need to close this now right? As you have completed the and merged the new structure.

from tensornetwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.