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

117
Views
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 answers
Answer question

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 Report
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!