Git Product home page Git Product logo

Comments (11)

amilsted avatar amilsted commented on May 3, 2024

By the way, I suspect (although I have not checked) that using the proposed environments() has the same asymptotic computational time scaling as using tf.gradients(). Hence it might only be advantageous for backends without autodiff functionality. On the other hand, environments() might be easier to fit into any upcoming automatic multi-device support?

from tensornetwork.

mganahl avatar mganahl commented on May 3, 2024

I think remove_node() is a great idea. It would reduce the length of MERA code (and also others) a lot. It would be good to also have the automated optimal contractor then. @Thenerdstation what is the status on that? I saw the stochastic contractor. Is someone working on a deterministic optimal cotractors?

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Adam is working on it, but he is a 20%er. I've asked him to add a branch of his work so far, so hopefully that'll be added soon.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Remove node should be easy enough to add. Though I think we'll use disconnect to break the edges rather than modify the edges in place. This is consistent with the rest of the code base.

from tensornetwork.

amilsted avatar amilsted commented on May 3, 2024

@Thenerdstation The only trouble I see with replacing the connected edges is that it makes it tricky to keep track of them across the remove_node(). In particular, I would want to know which of the new dangling edges was connected to which axis of the removed node. Ideally, I would not have to remember the axis ordering of the removed node for this to work - the axis names would be enough.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Could you give a tiny example of what your ideal workflow would look like? I still don't quite see how modifying the edges in place is more beneficial than just replacing them.

from tensornetwork.

amilsted avatar amilsted commented on May 3, 2024

Something like:

net = TensorNetwork()
n1 = net.add_node(t1, axis_names=['a', 'b', 'c'])
n2 = net.add_node(t2, ...)
...
# (connect edges so that there are no danglings)
...
output_edges = [n1['a'], n1['b'], n1['c']]
net.remove_node(n1)

net.contract_all_naively()  # or whatever :)

env = net.get_final_node()
env.reorder_edges(output_edges)  # want my output_edges to still be part of the network

# I might also want to contract the environment with another node.
# The following replaces the removed node to reproduce the result
# of contracting the original network.
n1 = net.add_node(t1, axis_names=['a', 'b', 'c'])
net.connect(n1['a'], output_edge[0])
net.connect(n1['b'], output_edge[1])
net.connect(n1['c'], output_edge[2])
net.contract_between(n1, env)

If the edges are replaced, one could alternatively have something like
output_edges = net.remove_node(n1, output_edge_axes=['a', 'b', 'c']), I suppose.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Oh I see what you mean now. You will need the broken edges for reshaping and to possibly connect it to a different node.

Let me think about this some more. I wanna keep the API as clean and intuitive as possible.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

Alright this is my compromise. remove_node() will return a Dict[Union[int, Text], Edge] which maps the index/axis name to the newly broken edge. That way, we can use disconnect and keep our current edge pattern consistent and you can continue to use the edge mapping that node had before.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

@amilsted Please comment on the PR if you have any concerns about the design choice.

from tensornetwork.

chaserileyroberts avatar chaserileyroberts commented on May 3, 2024

@mganahl You too.

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.