Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
Converting a tensor to an array - Tensorflow JS

I run a Keypoints detection model using tfjs and then post process it (still using tfjs). Then I use dataSync() on the final tensor in order to process it using JS. The dataSync() takes about 4 times more than the inference + post-processing time. I guess that it happens because dataSync() pulls the data from the GPU. Is there a way to make this process faster? Here's the code that I am using:

let output = model.execute(input_image_tensor);
let kpts = postProcess(output);
renderKpts(kpts.dataSync());

Thank you.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

dataSync() pulls data from specific tensor, so it depends on tensor size - what is the value of kpts.shape?
there is no chance if its just a few keypoints that it takes more than a milisecond.

** update **

just tried using webgl backend, it's around ~5 microseconds

const tensor = tf.randomNormal([1, 4, 3]);
const time0 = performance.now();
const data = tensor.dataSync();
const time1 = performance.now();
console.log({ size: tensor.size, time: time1 - time0 });
{ "size": 12, "time": 0.004999995231628418 }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda