akankshakshurai/cuda-error-resolution-analysis huggingface dataset:
How do I disable libtorch warning

Kiki_Rizki_Arpiandi: <p>Recently I deployed a program using libtorch. The program run as expected but its gives me a warning.</p>
<blockquote>
<p>Warning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters().</p>
</blockquote>
<p>How do I disable the warning ?</p>

botelho: <p>Can we please get an answer to this? I’m getting this message flooding my log files, which is not even a real warning, but just a heads-up about an upcoming change:</p>
<pre><code class="lang-auto">Warning: The default behavior for interpolate/upsample with float scale_factor will change in 1.6.0 to align with other frameworks/libraries, and use scale_factor directly, instead of relying on the computed output size. If you wish to keep the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details.  (_interp_output_size at /pytorch/caffe2/../torch/csrc/api/include/torch/nn/functional/upsampling.h:60)
</code></pre>
<p>To make it worse, there is no <code>recompute_scale_factor</code> parameter in <code>UpsampleOptions</code>, so I can’t really disable it through configuration when using the UpSample layer. So my hands are really tied here! Thanks in advance.</p>

ptrblck: <p>Could you pass the <code>scale_factor</code> as an integer or are you relying on the float value?</p>
<p>CC <a class="mention" href="/u/yf225">@yf225</a> the docs seem to miss the <code>recompute_scale_factor</code> argument from the last <a href="https://github.com/pytorch/pytorch/pull/35025">PR</a> (maybe I’m missing another WIP PR <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"> ).</p>

botelho: <p>My scale factors are already integers, and I get the warnings anyway.</p>
<p>But I guess the main question here is broader: isn’t there any way to disable <code>TORCH_WARN</code> messages via a runtime switch?</p>

Mohammadreza_Nazari: <aside class="quote no-group" data-username="botelho" data-post="4" data-topic="63439">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/botelho/48/12582_2.png" class="avatar"> botelho:</div>
<blockquote>
<p><code>TORCH_WARN</code></p>
</blockquote>
</aside>
<p>I do have the same question. Is there any option to control the verbosity of TORCH logs?</p>
Converting my np.ndarray input and mask to tensor but got an error

MA_CASANDRA_QUILANG: <p>Hi! I am trying to convert my input images and its masks to tensor from numpy.ndarray but I encountered an error along the way.</p>
<pre><code class="lang-auto">for img in train_gen:
  img = torch.from_numpy(img)
  print(img)</code></pre>

MA_CASANDRA_QUILANG: <p>and this is the error I got</p>
<pre><code class="lang-auto">TypeError                                 Traceback (most recent call last)
&lt;ipython-input-40-658119f1f5a6&gt; in &lt;module&gt;()
      1 for img in train_gen:
----&gt; 2   img = torch.from_numpy(img)
      3   print(img)

TypeError: expected np.ndarray (got tuple)</code></pre>

MA_CASANDRA_QUILANG: <p>Can someone help me? please.</p>

albanD: <p>Hi,</p>
<p>From the error message, it looks like “img” is a tuple and not a numpy array. So you should fix your code to make sure it is actually a numpy array.</p>