Error in simple example pytorch -> onnx -> tensorflowTensorflow: how to save/restore a model?TensorFlow not found using pipNameError: global name 'linear' is not definedMissing Weight Vectors when converting from PyTorch to CoreML via ONNXTrouble using openCV to load a net from ONNX (python/pytorch)Conversion from pytorch to onnx to tensorflow graph definition to tflite - TOCO failed - type check failexporting pytorch model through onnx to caffe2Transferring pretrained pytorch model to onnxError while converting pytorch to tensorflow through onnxPyTorch VAE fails conversion to onnx

Probability that a draw from a normal distribution is some number greater than another draw from the same distribution

What killed these X2 caps?

Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?

Ambiguity in the definition of entropy

Is it acceptable for a professor to tell male students to not think that they are smarter than female students?

Do UK voters know if their MP will be the Speaker of the House?

What's the in-universe reasoning behind sorcerers needing material components?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Can I run a new neutral wire to repair a broken circuit?

How do conventional missiles fly?

How to tell a function to use the default argument values?

How do I gain back my faith in my PhD degree?

What is the most common color to indicate the input-field is disabled?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Would Slavery Reparations be considered Bills of Attainder and hence Illegal?

Valid term from quadratic sequence?

Why is this clock signal connected to a capacitor to gnd?

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

Mathematica command that allows it to read my intentions

How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)

Detention in 1997

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Is it logically or scientifically possible to artificially send energy to the body?

What does the expression "A Mann!" means



Error in simple example pytorch -> onnx -> tensorflow


Tensorflow: how to save/restore a model?TensorFlow not found using pipNameError: global name 'linear' is not definedMissing Weight Vectors when converting from PyTorch to CoreML via ONNXTrouble using openCV to load a net from ONNX (python/pytorch)Conversion from pytorch to onnx to tensorflow graph definition to tflite - TOCO failed - type check failexporting pytorch model through onnx to caffe2Transferring pretrained pytorch model to onnxError while converting pytorch to tensorflow through onnxPyTorch VAE fails conversion to onnx













0















I'm trying to convert a pytorch model to a tensorflow model for inference using ONNX. Below is a simple example that fails with error:
ValidationError: model with IR version < 3 cannot have opset_import specified. What could cause this error? How is this done correctly?



The code is:



from torch.nn import Linear
from torch.autograd import Variable
from numpy.random import randn
from torch import from_numpy
from torch.onnx import export
from onnx import load
from onnx.checker import check_graph
from onnx_tf.backend import prepare
net = Linear(10, 2)
inp = Variable(from_numpy(randn(16, 10)).float())
export(net, args=inp, f='./test.pb', verbose=True,
training=False, export_params=True)
model = load('./test.pb')
check_graph(model.graph)
tfmodel = prepare(model)


Here are the versions of the used modules:




  • torch : 0.3.1.post2


  • numpy : 1.14.3


  • onnx : 1.1.1


  • onnx_tf : 1.1.1


  • tensorflow : 1.5.0

Btw: There's no tag ONNX yet. Is that project dead or still in the womb?










share|improve this question




























    0















    I'm trying to convert a pytorch model to a tensorflow model for inference using ONNX. Below is a simple example that fails with error:
    ValidationError: model with IR version < 3 cannot have opset_import specified. What could cause this error? How is this done correctly?



    The code is:



    from torch.nn import Linear
    from torch.autograd import Variable
    from numpy.random import randn
    from torch import from_numpy
    from torch.onnx import export
    from onnx import load
    from onnx.checker import check_graph
    from onnx_tf.backend import prepare
    net = Linear(10, 2)
    inp = Variable(from_numpy(randn(16, 10)).float())
    export(net, args=inp, f='./test.pb', verbose=True,
    training=False, export_params=True)
    model = load('./test.pb')
    check_graph(model.graph)
    tfmodel = prepare(model)


    Here are the versions of the used modules:




    • torch : 0.3.1.post2


    • numpy : 1.14.3


    • onnx : 1.1.1


    • onnx_tf : 1.1.1


    • tensorflow : 1.5.0

    Btw: There's no tag ONNX yet. Is that project dead or still in the womb?










    share|improve this question


























      0












      0








      0








      I'm trying to convert a pytorch model to a tensorflow model for inference using ONNX. Below is a simple example that fails with error:
      ValidationError: model with IR version < 3 cannot have opset_import specified. What could cause this error? How is this done correctly?



      The code is:



      from torch.nn import Linear
      from torch.autograd import Variable
      from numpy.random import randn
      from torch import from_numpy
      from torch.onnx import export
      from onnx import load
      from onnx.checker import check_graph
      from onnx_tf.backend import prepare
      net = Linear(10, 2)
      inp = Variable(from_numpy(randn(16, 10)).float())
      export(net, args=inp, f='./test.pb', verbose=True,
      training=False, export_params=True)
      model = load('./test.pb')
      check_graph(model.graph)
      tfmodel = prepare(model)


      Here are the versions of the used modules:




      • torch : 0.3.1.post2


      • numpy : 1.14.3


      • onnx : 1.1.1


      • onnx_tf : 1.1.1


      • tensorflow : 1.5.0

      Btw: There's no tag ONNX yet. Is that project dead or still in the womb?










      share|improve this question
















      I'm trying to convert a pytorch model to a tensorflow model for inference using ONNX. Below is a simple example that fails with error:
      ValidationError: model with IR version < 3 cannot have opset_import specified. What could cause this error? How is this done correctly?



      The code is:



      from torch.nn import Linear
      from torch.autograd import Variable
      from numpy.random import randn
      from torch import from_numpy
      from torch.onnx import export
      from onnx import load
      from onnx.checker import check_graph
      from onnx_tf.backend import prepare
      net = Linear(10, 2)
      inp = Variable(from_numpy(randn(16, 10)).float())
      export(net, args=inp, f='./test.pb', verbose=True,
      training=False, export_params=True)
      model = load('./test.pb')
      check_graph(model.graph)
      tfmodel = prepare(model)


      Here are the versions of the used modules:




      • torch : 0.3.1.post2


      • numpy : 1.14.3


      • onnx : 1.1.1


      • onnx_tf : 1.1.1


      • tensorflow : 1.5.0

      Btw: There's no tag ONNX yet. Is that project dead or still in the womb?







      tensorflow pytorch onnx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 22:16









      dashesy

      1,52323049




      1,52323049










      asked May 21 '18 at 21:07









      JusJus

      1899




      1899






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50456628%2ferror-in-simple-example-pytorch-onnx-tensorflow%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50456628%2ferror-in-simple-example-pytorch-onnx-tensorflow%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович