Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
Uncaught (in promise) TypeError: d is not a function - tensorflow js

i'm trying to do a prediction with tensorflow js, but when I try to predict have de following error:

Uncaught (in promise) TypeError: d is not a function at tfjs@latest:17:162006 at tfjs@latest:17:159769 at e.t.scopedRun (tfjs@latest:17:159898) at e.t.tidy (tfjs@latest:17:159666) at n (tfjs@latest:17:161982) at tfjs@latest:17:162468 at e.t.scopedRun (tfjs@latest:17:159898) at e.t.runKernelFunc (tfjs@latest:17:162190) at slice_ (slice.js:177:17) at slice (operation.js:45:22)

This is my javascript code:

<script>
    
    async function inicializar() {
        alert("estoy en inicialize");
        document.getElementById('prediccion').addEventListener('click', () => predecir());

    };

    async function predecir() {
        
        alert("estoy en predecir"); //Mensaje para chequear que entre aca
        const modelo = await tf.loadLayersModel('trained-model/model.json');
        const canvas = document.getElementById('output');
        
        alert(canvas);// Mensaje para ver si lee canvas como elemento HTML

      
        let tensorImg = tf.browser.fromPixels(canvas).resizeNearestNeighbor([150, 150]).toFloat().expandDims();
        alert("pasa esto"); //Mensaje para chequear que entre aca
        alert(tensorImg); //Mensaje para ver si lee el tensor de la imagen
        
        prediction = modelo.predict(tensorImg).data(); //Aca me da error!!!!! TypeError: d is not a function
        
        alert("pase hasta aca"); //Mensaje para chequear que entre aca, pero no llega

        var respuesta;
        
        if (prediction <= .5) {
          respuesta = "Gato";
        } else {
          respuesta = "Perro";
        }
        document.getElementById("prediccion").innerHTML = respuesta;

    };
 
    inicializar()
    
    </script>

Thanks for your help!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!