Git Product home page Git Product logo

Comments (11)

odelalleau avatar odelalleau commented on June 3, 2024

So, to answer my own question, I think it's a good idea to try to guess broadcastability, as it should not be harmful (although, out of curiosity, I ran the test suite with this feature disabled and all tests pass except the one that specifically test for this feature).

Here is a suggestion for a better fix (better than #284):

  1. Add an optional broadcastable argument to Reshape.make_node. When this argument is provided, then the op just uses the provided broadcastable pattern for the output, without attempting to make any guess. The local_reshape_chain optimization would then use this argument to force the broadcastable pattern to remain unchanged.
  2. In a normal situation, we should expect the current implementation of local_reshape_chain not to modify the broadcastable pattern anyway. If it modifies it, it means there is probably something suspicious elsewhere. So I would also suggest to have a warning when this happens (which could be disabled by a config.warn option).

Thoughts?

from theano.

nouiz avatar nouiz commented on June 3, 2024

I merged #284 as this fix an issue. This will help find the root cause in the problem in issue #276.

I still don't understand why this error happen. But if we don't care about that, I would prefer that we add a rebroadcast op after the new reshape then allow Reshape.make_node take an additional parameter. That is what we did at a few other place where it make sense.

If I have time, I'll try to understandwhy the broadcast pattern change.

from theano.

odelalleau avatar odelalleau commented on June 3, 2024

Are Rebroadcast Ops automatically removed during the optimization phase? If yes then I'm good with it.

from theano.

nouiz avatar nouiz commented on June 3, 2024

Not yet, but they should be we should do it. Anyway, they are inplace, so they are a fast constant time for now.

from theano.

nouiz avatar nouiz commented on June 3, 2024

I created gh-288 issue for to remove the rebroadcast

from theano.

odelalleau avatar odelalleau commented on June 3, 2024

My main concern is that Rebroadcast Ops may disrupt some optimizations (because the pattern that an optimization is looking for will typically not contain Rebroadcasts).
It seems to me that whenever we have a Rebroadcast which is the only parent of its input, then we can remove the Rebroadcast (within the optimization process) and just modify the type of the input directly. Am I wrong?

from theano.

nouiz avatar nouiz commented on June 3, 2024

It is not that easy. If you try to "clone the graph"/"rebuild the graph with other inputs" without the Rebroadcast, it could have problem. Maybe we could work around that and allow this, but this is not an easy/fast change. The real underling questions is how to remove it automatically for all op without making the graph being able to be rebuild.

Or maybe we can just continue in the direction that optimized graph are not portable and tell they are not rebuildable? That should way after 0.5 and I would prefer confirmation by other people on that before doing it.

from theano.

odelalleau avatar odelalleau commented on June 3, 2024

Ok.
What if we keep the type of each variable in the graph as part of the graph information needed to "clone / rebuild" the graph? (not sure if that's a sensible idea -- I don't know where in the code we do this kind of operation)

from theano.

nouiz avatar nouiz commented on June 3, 2024

I think we should continue that discussion after NIPS. I have other stuff to think about and this is not easy change to do if we don't want to break stuff. But as I told, maybe the final solution is to don't care about clone/rebuild as this is during compilation.

from theano.

odelalleau avatar odelalleau commented on June 3, 2024

No problem, this can wait.

from theano.

nouiz avatar nouiz commented on June 3, 2024

There is a ticket for the general fix: gh-288, so I close this one.

from theano.

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.