Conv2D: Padding TypeError

cjfghk5697: <h1><a name="system-information-1" class="anchor" href="#system-information-1"></a>System information</h1>
<p>Environment: Colab</p>
<h1><a name="error-2" class="anchor" href="#error-2"></a>Error</h1>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/8/a84a1b3db33358fc1e1d459c290d6f88ed7a1ca2.png" data-download-href="https://discuss.pytorch.org/uploads/default/a84a1b3db33358fc1e1d459c290d6f88ed7a1ca2" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/a/8/a84a1b3db33358fc1e1d459c290d6f88ed7a1ca2.png" alt="image" data-base62-sha1="o0KZd89EaOkTctLCwMiSkhB8cz8" width="690" height="247" data-dominant-color="3D3D3D"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1483×531 15.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
I want to solve this error.</p>
<h1><a name="error-code-3" class="anchor" href="#error-code-3"></a>Error Code</h1>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://colab.research.google.com/drive/1OmVafk9rWK7fNWW5lEBwiwRjZea3BR2e?usp=sharing">
  <header class="source">
      <img src="https://ssl.gstatic.com/colaboratory-static/common/ac0e6bae38aa2b5a52a4f6e10b43c43d/img/favicon.ico" class="site-icon" width="128" height="128">

      <a href="https://colab.research.google.com/drive/1OmVafk9rWK7fNWW5lEBwiwRjZea3BR2e?usp=sharing" target="_blank" rel="noopener nofollow ugc">colab.research.google.com</a>
  </header>

  <article class="onebox-body">
    <img width="260" height="260" src="https://colab.research.google.com/img/colab_favicon_256px.png" class="thumbnail onebox-avatar">

<h3><a href="https://colab.research.google.com/drive/1OmVafk9rWK7fNWW5lEBwiwRjZea3BR2e?usp=sharing" target="_blank" rel="noopener nofollow ugc">Google Colaboratory</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<h1><a name="in-detail-4" class="anchor" href="#in-detail-4"></a>In detail</h1>
<p>I try EfficientNetB0. And I use ConV2D. train dataset is work well.  But test dataset not work. I think It’s problem Padding data type. But I don’t know how can solve this problem?<br>
Plz help me</p>

ptrblck: <p>The error message states that you are passing a <code>DataLoader</code> instance to <code>F.conv2d</code>, which is wrong, so make sure to pass the input tensors to this operation instead.</p>
<p>PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=10" title=":wink:" class="emoji" alt=":wink:"></p>

cjfghk5697: <p><a class="mention" href="/u/ptrblck">@ptrblck</a> Thank for your answer and advice. I don’t know how solve this problem…<br>
Can see some example?</p>

ptrblck: <p>You are passing the <code>DataLoader</code> directly to the model in:</p>
<pre><code class="lang-python">result=model(test_loader)
</code></pre>
<p>while you would have to iterate the <code>DataLoader</code> and pass the input tensors to the model.<br>
Take a look at <a href="https://pytorch.org/tutorials/beginner/nn_tutorial.html#refactor-using-dataloader">this tutorial</a> for a simple example.<br>
In your case something like:</p>
<pre><code class="lang-python">for data, target in test_loader:
    output = model(data)
</code></pre>
<p>should work.</p>