Coder Social home page Coder Social logo

Comments (5)

stevenabreu7 avatar stevenabreu7 commented on May 28, 2024

I agree, right now the only use case for "free dimensions" is to have only convolution operations in sequence. For any other primitive, we need to know the input shape. To my mind, that is not a particularly common or interesting use case.

More generally, I think that having "parameterizable NIR graphs" (parameterising the input shape, or even number of layers, etc.) is interesting but should likely live outside of NIR - NIR as an intermediate representation should have full information to compile and execute a program it describes. But someone could build something like a "NIR Factory" which generates NIR graphs given some parameters, if that's useful enough to someone.

from nir.

sheiksadique avatar sheiksadique commented on May 28, 2024

Ok I will take the opposing side on this discussion and make my case.

Nodes are meant to be functional transformations on data and so "deterministic" in the relationship between inputs and outputs.

Therefore in most, if not all, cases, the input and output dimensions are inferable within a network given sufficient description of each of the nodes and the graph structure.

Forcing this intermediate information the way I see it is therefore redundant and can lead to bugs or inconsistent graph definitions where the dimensions don't match but could syntactically look accurate. Except for the "convenience" of having this information locally available to each node, this specification doesn't serve any purpose and introduces the possibility of introducing bugs.

For any scenario where this information is actually needed, like neuron instantiation, it is already available in the IR of these nodes.

from nir.

sheiksadique avatar sheiksadique commented on May 28, 2024

To be clear I am not opposed to specifying input dimension, in most cases this is necessary. I am only concerned with this being a requirement for every node, including those node types that are not necessarily bound by input shapes/dimensions.

from nir.

stevenabreu7 avatar stevenabreu7 commented on May 28, 2024

I agree that it would be possible (and convenient) to defer the definition of some nodes' input/output types to when we initialise the whole graph. Perhaps in NIRGraph.post_init, we can compute the input/output types of pooling and convolution layers (i.e. start with nodes where input/output types are defined, and continually define the set of adjacent nodes). We can throw an error if the type of some remaining nodes cannot be inferred.

Would this be a good solution?

from nir.

Jegp avatar Jegp commented on May 28, 2024

Closing with #59

from nir.

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.