Giter VIP home page Giter VIP logo

Comments (4)

justinchuby avatar justinchuby commented on July 27, 2024

Does op.Concat(zero, zero, padded_row, padded_col) work for you?

from onnxscript.

vincentme avatar vincentme commented on July 27, 2024

Does op.Concat(zero, zero, padded_row, padded_col) work for you?

Thanks! Because these tensors are indeed scalars, so I have to unsqueeze them to 1D then concat, the following works. Not sure if this is a better way...

pads = op.Concat(op.Unsqueeze(zero, axes=[0]), op.Unsqueeze(zero, axes=[0]), op.Unsqueeze(pad_row, axes=[0]), op.Unsqueeze(pad_col, axes=[0]), axis = 0)

from onnxscript.

gramalingam avatar gramalingam commented on July 27, 2024

A naive question: how is this being run? I am a bit puzzled because this mixed-mode construction (interleaving script-time computation with onnx-construction) is doable in trace-mode, but not in script-mode.

Otherwise: nothing much to add to the existing discussion. If the shape is statically known, there may be other ways of doing this. But I assume you want to handle dynamic shapes here? So, Concat, as above, seems reasonable.

from onnxscript.

vincentme avatar vincentme commented on July 27, 2024

A naive question: how is this being run? I am a bit puzzled because this mixed-mode construction (interleaving script-time computation with onnx-construction) is doable in trace-mode, but not in script-mode.

Otherwise: nothing much to add to the existing discussion. If the shape is statically known, there may be other ways of doing this. But I assume you want to handle dynamic shapes here? So, Concat, as above, seems reasonable.

Sorry, i am not quite understand your comments... The script or trace modes are the ones in pytorch export?

If so, my context is different. The goal is not convert from pytorch, but directly write algorithm(not necessary deep learning model) in onnxscript. As shown inthis example, one step is to pad the image to the power of two. The shape of the input image is dynamic, but the shape of the pads is of course fixed as (4,).

from onnxscript.

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.