Linalg_norm crash with simple operation

username: WeNeedMore
cooked: <p>The app crash after I call the linarg_norm api, it works fine in python</p>
<p>OS : win10 64bits<br>
libtorch version : 1.9.0 cpu<br>
compiler : vc2019</p>
<pre><code class="lang-auto">#include &lt;iostream&gt;
#include &lt;torch/script.h&gt;

int main()
{
    try{
        torch::Tensor input = torch::empty({1, 1, 2});
        torch::linalg_norm(input, 2, -1, true);
    }catch(std::exception const &amp;ex){
        std::cerr&lt;&lt;ex.what()&lt;&lt;std::endl;
    }
}
</code></pre>
<p>error message :</p>
<pre><code class="lang-auto">exception:Dimension out of range (expected to be in range of [-3, 2], but got 140715421935248)
Exception raised from maybe_wrap_dim at ..\..\c10/core/WrapDimMinimal.h:33 (most recent call first):
00007FFAA37910D200007FFAA3791070 c10.dll!c10::Error::Error [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFAA3763EE500007FFAA3763E70 c10.dll!c10::IndexError::IndexError [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA32EB8BC600007FFA32EB8A20 torch_cpu.dll!at::impl::MetaBase::maybe_get_output [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA330BA27F00007FFA330B97C0 torch_cpu.dll!at::native::lu_unpack_out [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA330B81D200007FFA330B8100 torch_cpu.dll!at::native::linalg_vector_norm [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA339A83B100007FFA338A9020 torch_cpu.dll!at::redispatch::zeros_outf [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA3398100000007FFA338A9020 torch_cpu.dll!at::redispatch::zeros_outf [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA3372EA8C00007FFA33702450 torch_cpu.dll!at::zeros_outf [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA3380812100007FFA33808060 torch_cpu.dll!at::redispatch::linalg_vector_norm [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA34C3218200007FFA34A166A0 torch_cpu.dll!torch::jit::Value::wrap [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA34C15A1E00007FFA34A166A0 torch_cpu.dll!torch::jit::Value::wrap [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA33618FB800007FFA33618E40 torch_cpu.dll!at::linalg_vector_norm [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA330B567E00007FFA330B4CD0 torch_cpu.dll!at::native::linalg_norm_out [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA330B49E200007FFA330B4870 torch_cpu.dll!at::native::linalg_norm [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA33AE300100007FFA338A9020 torch_cpu.dll!at::redispatch::zeros_outf [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA33ACDF2000007FFA338A9020 torch_cpu.dll!at::redispatch::zeros_outf [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFA336116F800007FFA33611580 torch_cpu.dll!at::linalg_norm [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FF7A990A30F00007FF7A990A100 test_libtorch_model.exe!c10::ivalue::Future::waitAndThrow [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FF7A990ABB000007FF7A990A100 test_libtorch_model.exe!c10::ivalue::Future::waitAndThrow [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFADE40703400007FFADE407020 KERNEL32.DLL!BaseThreadInitThunk [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
00007FFADF0A265100007FFADF0A2630 ntdll.dll!RtlUserThreadStart [&lt;unknown file&gt; @ &lt;unknown line number&gt;]
</code></pre>
<p>Any clue how to use this api properly? Thanks</p>

username: ptrblck
cooked: <p>Could you create an issue on <a href="https://github.com/pytorch/pytorch/issues">GitHub</a> so that we can track and fix this issue, please?</p>