<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Problem compiling onnx model using GLOW compiler: constant not found in eIQ Machine Learning Software</title>
    <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1324082#M397</link>
    <description>&lt;P&gt;I'm trying to compile a custom onnx model to use it on an IMX RT1060 but when I try to compile using the command line&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;model-compiler.exe -model=VSGmodel\politicaVSG.onnx -model-input=Estado,float,[1,6] -emit-bundle=source -backend=CPU -target=arm -mcpu=cortex-m7 -float-abi=hard&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I get an error that reads&lt;/FONT&gt; "could not find constant with name 278" &lt;FONT face="arial,helvetica,sans-serif"&gt;and I think is related to the issue metioned in &lt;A href="https://github.com/pytorch/glow/issues/3827" target="_blank"&gt;[Reshape] Allow the shape to be computed from constants · Issue #3827 · pytorch/glow&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The problem seems to be a gather operation in my model and I don't really know if there is a way to solve the issue or if it is an incompatibility with GLOW. My guess is that the GLOW toolkit available form NXP is based on an old version of GLOW where the &lt;A href="https://github.com/pytorch/glow/issues/3827" target="_self"&gt;issue #3837&lt;/A&gt; had not yet been fixed.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how I could solve this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach my onnx model (compressed in a zip) if it helps&lt;/P&gt;</description>
    <pubDate>Mon, 16 Aug 2021 19:49:09 GMT</pubDate>
    <dc:creator>LuisMedina-08</dc:creator>
    <dc:date>2021-08-16T19:49:09Z</dc:date>
    <item>
      <title>Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1324082#M397</link>
      <description>&lt;P&gt;I'm trying to compile a custom onnx model to use it on an IMX RT1060 but when I try to compile using the command line&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;model-compiler.exe -model=VSGmodel\politicaVSG.onnx -model-input=Estado,float,[1,6] -emit-bundle=source -backend=CPU -target=arm -mcpu=cortex-m7 -float-abi=hard&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I get an error that reads&lt;/FONT&gt; "could not find constant with name 278" &lt;FONT face="arial,helvetica,sans-serif"&gt;and I think is related to the issue metioned in &lt;A href="https://github.com/pytorch/glow/issues/3827" target="_blank"&gt;[Reshape] Allow the shape to be computed from constants · Issue #3827 · pytorch/glow&lt;/A&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;The problem seems to be a gather operation in my model and I don't really know if there is a way to solve the issue or if it is an incompatibility with GLOW. My guess is that the GLOW toolkit available form NXP is based on an old version of GLOW where the &lt;A href="https://github.com/pytorch/glow/issues/3827" target="_self"&gt;issue #3837&lt;/A&gt; had not yet been fixed.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Any thoughts on how I could solve this issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach my onnx model (compressed in a zip) if it helps&lt;/P&gt;</description>
      <pubDate>Mon, 16 Aug 2021 19:49:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1324082#M397</guid>
      <dc:creator>LuisMedina-08</dc:creator>
      <dc:date>2021-08-16T19:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1325968#M398</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/190290"&gt;@LuisMedina-08&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I believe that our GLOW version is not so old that this fix would not be included. Usually, the last official GLOW commit available is taken and ported to the SDK and there have been several SDK releases since then. I will check with the developers which commit was used in SDK 2.10 exactly.&lt;/P&gt;
&lt;P&gt;However, it does seem like the behavior is very similar to the issue you linked to and I couldn't find anything else about it either. Can you provide more information about the model structure? Do you know exactly which operation at which location inside the graph is causing this error or were you just guessing with the gather operation?&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 05:29:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1325968#M398</guid>
      <dc:creator>david_piskula</dc:creator>
      <dc:date>2021-08-19T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1326027#M399</link>
      <description>&lt;P&gt;Thanks for your prompt reply.&amp;nbsp;&lt;SPAN&gt;When loading the model on &lt;/SPAN&gt;&lt;A href="https://netron.app/" target="_self"&gt;Netron&lt;/A&gt;&lt;SPAN&gt;, the constant not found by the compiler seems to be the output of a "Where" node (precisely node "Where_186" in the graph), which along with other nodes previous to it, is the result of translating a gather operation from my original Pytorch model to an equivalent&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;set of operations in the&lt;/SPAN&gt;&amp;nbsp;ONNX model&lt;SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The structure of the model is basically a multi layer ANFIS and if it helps, the gather operation is used to expand a tensor of activation degrees to combine it with a tensor of consequents of fuzzy rules.&lt;/P&gt;&lt;P&gt;From the issue I linked in the original post and &lt;A href="https://github.com/pytorch/glow/issues/3932" target="_self"&gt;similar issues&lt;/A&gt; listed in the Glow repository, the problem seems to be non constant shape tensors, but last year a solution was found and&amp;nbsp;&lt;A href="https://github.com/pytorch/glow/pull/4027" target="_self"&gt;it was soon implemented&lt;/A&gt;, so the problem should not persist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps the issue I have with my model is not the same, but I don't have enough information to know better.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 06:51:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1326027#M399</guid>
      <dc:creator>LuisMedina-08</dc:creator>
      <dc:date>2021-08-19T06:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1327765#M401</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/190290"&gt;@LuisMedina-08&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I had a call with one of our engineers who provided me with some useful information about the older issue that seems similar to yours.&lt;/P&gt;&lt;P&gt;The most important thing is that GLOW is a static compiler and therefore doesn't work with dynamic shapes and values and requires constants everywhere.&lt;/P&gt;&lt;P&gt;In the case of the &lt;A href="https://github.com/pytorch/glow/issues/3827" target="_self"&gt;Reshape issue&lt;/A&gt; you linked, the reshape computation itself was dynamic but all of the inputs of the computation were static. The issue was solved by adding a constant folding mechanism, which allows GLOW to compute the dynamic value during compilation.&lt;/P&gt;&lt;P&gt;Now, your issue seems similar in nature, however, the constant folding fix is already present in the SDK GLOW (the engineer confirmed this by testing a model with the same reshape computation as mentioned in the Reshape issue). I am not familiar with the Where operator but if your problem were exactly the same, the model would compile successfully.&lt;/P&gt;&lt;P&gt;(Btw. We checked and the Where operator is supported by the GLOW included in our SDK.)&lt;/P&gt;&lt;P&gt;So, in order to move forward, I think we need to determine the following:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Is your model static or dynamic? If it's dynamic, it won't work with GLOW.&lt;/LI&gt;&lt;LI&gt;Are there any dynamically computed values in the model? (like the computations of shapes)&lt;/LI&gt;&lt;LI&gt;If yes, do they have static inputs? If so, perhaps the issue could be solved the same way the Reshape issue was solved.&lt;/LI&gt;&lt;LI&gt;If yes, but some of the inputs are not static, would it be possible to change the model architecture so that they are static instead?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have no experience with ANFIS networks. Perhaps there is some kind of mechanism in their architecture, which makes them incompatible with GLOW.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 11:36:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1327765#M401</guid>
      <dc:creator>david_piskula</dc:creator>
      <dc:date>2021-08-23T11:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1327944#M403</link>
      <description>&lt;P&gt;Thanks for the insight, I was able to modify the model to always use tensors of the same size and it solved the issue of the missing constant, but also revealed another issue which has to do with the&amp;nbsp;"&lt;A href="https://github.com/onnx/onnx/blob/master/docs/Operators.md#GatherElements" target="_self"&gt;GatherElements&lt;/A&gt;" operation in the ONNX model. Now when I run the command to compile the model, I get an error that reads "&lt;FONT face="courier new,courier"&gt;Error Code: MODEL_LOADER_USUPPORTED_OPERATOR&lt;/FONT&gt;" and "&lt;FONT face="courier new,courier"&gt;Error Message: Failed to load operator GatherElements&lt;/FONT&gt;".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/153742i9ABAD054185F0FE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/153747i7A82AC6B349B7CC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;According to&amp;nbsp;&lt;A href="https://github.com/pytorch/glow/pull/5285," target="_blank"&gt;https://github.com/pytorch/glow/pull/5285,&lt;/A&gt;&amp;nbsp;this should no longer be a problem, since support for such operator was added since May 10th of this year. Any ideas on what could be the issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 17:44:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1327944#M403</guid>
      <dc:creator>LuisMedina-08</dc:creator>
      <dc:date>2021-08-23T17:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1329444#M408</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/190290"&gt;@LuisMedina-08&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the GLOW in our SDK is based on a late June release, however, the pull request you linked to adds only partial support for the operator:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;it's adding support specifically to the torch.gather operator&lt;/LI&gt;&lt;LI&gt;it's adding support for the interpreter backend of GLOW, whereas we use the CPU backend of GLOW instead&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Could you try replacing the GatherElements with a different Gather operator, like Gather or GatherND or would that not work?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 12:13:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1329444#M408</guid>
      <dc:creator>david_piskula</dc:creator>
      <dc:date>2021-08-25T12:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1329811#M409</link>
      <description>&lt;P&gt;Unfortunately I can't change the exact Gather operator the ONNX model implements, as it is chosen by Pythorch during the translation of the original model to the ONNX format. In view of this I assume the only option is to wait for further updates of the GLOW compiler to eventually add compatibility with such operator. Thanks for the support.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Aug 2021 22:59:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1329811#M409</guid>
      <dc:creator>LuisMedina-08</dc:creator>
      <dc:date>2021-08-25T22:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem compiling onnx model using GLOW compiler: constant not found</title>
      <link>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1330195#M411</link>
      <description>&lt;P&gt;I see, in that case, yeah, you will have to wait until support for this operator is implemented. Perhaps you could raise the issue on GitHub and let them know that there is a need for this operator so that they might decide to prioritize it over others.&lt;/P&gt;&lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 08:53:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/eIQ-Machine-Learning-Software/Problem-compiling-onnx-model-using-GLOW-compiler-constant-not/m-p/1330195#M411</guid>
      <dc:creator>david_piskula</dc:creator>
      <dc:date>2021-08-26T08:53:04Z</dc:date>
    </item>
  </channel>
</rss>

