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

569
Views
Tensorflow js, How to get the output of each layer?

How can I get the output of each layer in Tensorflow JS (Javascript)?

For now I am doing this:

const input_nodes = 5;
const hidden_nodes = 8;
const output_nodes = 4;

let inputs = [1, 2, 3, 4, 5];
const xs = tf.tensor2d([inputs]);

let model1 = tf.sequential();    
model1.add(tf.layers.dense({ units: hidden_nodes, inputShape: [input_nodes], activation: 'sigmoid' }));
console.log(model1.predict(xs).dataSync()); // Output for Layer 1

let model2 = tf.sequential();
model2.add(tf.layers.dense({ units: hidden_nodes, inputShape: [input_nodes], activation: 'sigmoid' }));
model2.add(tf.layers.dense({ units: output_nodes, activation: 'softmax' }));
console.log(model2.predict(xs).dataSync()); // Output for Layer 1

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!