Giter Club home page Giter Club logo

Comments (8)

yuslepukhin avatar yuslepukhin commented on June 25, 2024

You are dealing with a model that has dynamic shapes. The error above usually occurs, when the dynamic shape does not propagate properly downstream and there is a mismatch in some part. For example, it might have an initializer that requires only a fixed shape, so the model would work with one shape, but not another.

from onnxruntime.

xju2 avatar xju2 commented on June 25, 2024

Is there a workaround we can implement to fix the issue for the given model in release 1.17.3?

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 25, 2024

The issue is likely with the model, but it might be a converter issue as well. What is the source of your model? Is it a pytorch converted model or it is created in house?

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 25, 2024

If you sess_opts.enable_mem_reuse = False then the model runs, but does not produce expected shapes. This is again because the dynamic shapes are not propagated properly.

2024-04-26 11:51:37.4997890 [W:onnxruntime:, execution_frame.cc:879 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {-1} does not match actual shape of {0,8} for output /Squeeze_4_output_0
2024-04-26 11:51:37.5124220 [W:onnxruntime:, execution_frame.cc:879 onnxruntime::ExecutionFrame::VerifyOutputSizes] Expected shape from model of {-1} does not match actual shape of {0,8} for output GN2v01_TrackOrigin

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 25, 2024

Let me dig some more

from onnxruntime.

xju2 avatar xju2 commented on June 25, 2024

The issue is likely with the model, but it might be a converter issue as well. What is the source of your model? Is it a pytorch converted model or it is created in house?

It is converted from Pytorch.

from onnxruntime.

yuslepukhin avatar yuslepukhin commented on June 25, 2024

The following node has a hardcoded output shape to 'n_tracks'. When you run the model with the given inputs Squeeze gets a shape of {1, 0, 8} and outputs {0,8} which cannot match a 1-D shape.

Similar story with another node. Dynamic shapes are tricky. However, that node certainly cannot hardcode 1-D shape for its output.

Alternatively, you may need to look upstream, perhaps, that 0 would have been Squeezed out if it was 1.

node {
    input: "/Equal_output_0"
    output: "/If_output_0"
    name: "/If"
    op_type: "If"
    attribute {
      name: "then_branch"
      g {
        node {
          input: "/ArgMax_output_0"
          input: "/Constant_5_output_0"
          output: "/Squeeze_4_output_0"
          name: "/Squeeze_4"
          op_type: "Squeeze"
        }
        name: "torch_jit1"
        initializer {
          dims: 1
          data_type: 7
          name: "/Constant_5_output_0"
          raw_data: "\000\000\000\000\000\000\000\000"
        }
        doc_string: ""
        output {
          name: "/Squeeze_4_output_0"
          type {
            tensor_type {
              elem_type: 7
              shape {
                dim {
                  dim_param: "n_tracks"
                }
              }
            }
          }
        }
      }
      type: GRAPH
    }
    attribute {
      name: "else_branch"
      g {
        node {
          input: "/ArgMax_output_0"
          output: "/Identity_output_0"
          name: "/Identity"
          op_type: "Identity"
        }
        name: "torch_jit2"
        doc_string: ""
        output {
          name: "/Identity_output_0"
          type {
            tensor_type {
              elem_type: 7
              shape {
                dim {
                  dim_param: "Identity/Identity_output_0_dim_0"
                }
                dim {
                  dim_param: "n_tracks"
                }
              }
            }
          }
        }
      }
      type: GRAPH
    }
  }

from onnxruntime.

xju2 avatar xju2 commented on June 25, 2024

Thanks for looking into this in depth. We will try to improve the model architecture next time to avoid hardcoded dimensions.

I tried with the option sess_opts.enable_mem_reuse = False and observed the same error. Do you know why it runs well in release 1.15 but not in 1.17?

from onnxruntime.

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.