title: Requested texture size [0x0] is invalid. error when i am loading image in browser
body: <p>Tensorflow.js error in browser while calling predict function</p>
  
  <p>I'm using Node.js to run the webapp. This is my scripts I have included and I'm running Node.js in Chrome and not able to solve the error.</p>
  
  <p>This project has 7 classes as output that is dense layer in output of shape 1x7.</p>
  
  <pre><code>https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js
  https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js
  https://code.jquery.com/jquery-3.3.1.slim.min.js
  </code></pre>
  
  <p>This is my JavaScript file.</p>
  
  <pre><code> $(document).on('change', '#file', function() {
  
      let reader = new FileReader();
      reader.onload= function(){
          let dataUrl = reader.result;
          $('#selected-image').attr('src',dataUrl);
          $('#type1-predict').empty();
          $('#type2-predict').empty();
          $('#type3-predict').empty();
          $('#type4-predict').empty();
          $('#type5-predict').empty();
          $('#type6-predict').empty();
          $('#type7-predict').empty();
      }
  
      let file = $('#file').prop('files')[0];
      reader.readAsDataURL(file)
      });
      const CANCER_CLASSES = {
      0:"Actinic Keratoses",
      1:"Basal cell carcinoma",
      2:"Benign keratosis",
      3:"Dermatofibroma",
      4:"Melanoma",
      5:"Melanocytic nevi",
      6:"Vascular skin",    
      }
      let model;
      (async function(){
      model= await tf.loadLayersModel('http://localhost:81/model/model.json');
      $('#pro').hide()
  
      })();
      $(document).on('click', '#predict-button', async function() { 
      let image = $('#selected-image').get(0);
  
      let tensor = 
      tf.browser.fromPixels(image)
          .resizeNearestNeighbor([224,224])
          .toFloat()
          .expandDims();
      let prediction = await model.predict(tensor).data();
      let top3 = Array.from(prediction)
      .map(function(p,i){
          return {
              probab: p,
              classname:CANCER_CLASSES[i]
          };
  
      }).sort(function(a,b){
          return b.probab-a.probab;
      }).slice(0,4);
      $("#type1-predict").empty();
      top3.forEach(function(p){
          $('#type1-predict').append(`&lt;li&gt;${p.classname}: 
      ${p.probab.tpFixed(6)} 
      &lt;/li&gt;`);
      });
      });
  </code></pre>
  
  <p>This is a snippet of the HTML file</p>
  
  <pre><code>&lt;body&gt;
  &lt;div id="pro" class="progress progress-bar progress-bar-striped progress- 
  bar-animated"&gt;&lt;/div&gt;    
  &lt;input type="file" id="image-selector"&gt;
  &lt;button id="predict-button"&gt;Predict&lt;/button&gt;
  &lt;p style="font-weight:bold"&gt;Presentation&lt;/p&gt;
  &lt;p&gt;Actinic Keratoses : &lt;span id="type1-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Basal cell carcinoma: &lt;span id="type2-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Benign keratosis: &lt;span id="type3-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Dermatofibroma: &lt;span id="type4-predict"&gt;&lt;/span&gt;&lt;/p&gt;
   &lt;p&gt;Melanoma: &lt;span id="type5-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Melanocytic nevi : &lt;span id="type6-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;Vascular skin: &lt;span id="type7-predict"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;img id="selected-image" src=""&gt;
  </code></pre>
  
  <p>Could you help me resolve the following error:</p>
  
  <pre><code> webgl_util.ts:203 Uncaught (in promise) Error: Requested texture size 
      [0x0] is invalid.
      at Fr (webgl_util.ts:203)
      at oi (gpgpu_util.ts:126)
      at ui (gpgpu_util.ts:173)
      at t.createUnsignedBytesMatrixTexture (gpgpu_context.ts:134)
      at t.acquireTexture (texture_manager.ts:71)
      at t.acquireTexture (backend_webgl.ts:2472)
      at t.uploadToGPU (backend_webgl.ts:2407)
      at t.getTexture (backend_webgl.ts:566)
      at t.fromPixels (backend_webgl.ts:254)
      at t.fromPixels (engine.ts:599)
  </code></pre>