question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Where to put array in model.predict() function

See original GitHub issue

I have imported a pre trained keras model in my jvascript. I want to put array into the model to get he output. To convert the array to sensor I am taking the help from model.predict(tf.ones([8, 10]), {batchSize: 4}).print(); written in tfjs tutorial.

But where and how should I keep my array inside this model.predict() function.

I have to insert array([[0., 0., 0., …, 0., 0., 0.]]) with (1,30000) shape. I tried following line but couldn’t get the result: console.log(model.predict(tf.ones([1, 30000]), Array(b))); Please tell me how to do it so I can get the output.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kallolscommented, Apr 12, 2018

@xam-ps Thank you so much, The code is working.

1reaction
xam-pscommented, Apr 12, 2018

@kallols To get the data from the tensor I’m using the data() function. For your case this should be sth. like:

newoutput.data().then(function(label){ console.log(label[0]); console.log(label[1]); });

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make model.predict in array? - python - Stack Overflow
i want my model.predict shows me an array ([0. 1.] or [1. 0.]) instead of just a single number 0 or 1, so...
Read more >
What does the output of model.predict function from Keras ...
I am only showing the first 10 values in the array. I don't understand what do these values mean and what is the...
Read more >
How to use a model to do predictions with Keras - ActiveState
Keras models can be used to detect trends and make predictions, using the model.predict() class and it's variant, ...
Read more >
How to Make Predictions with Keras - Machine Learning Mastery
This can be passed to the predict_classes() function on our model in order to predict the class values for each instance in the...
Read more >
Making predictions - Decision Forests - TensorFlow
Use the model.predict() function on Numpy arrays. Make predictions with the CLI API. Benchmark the inference speed of a model with the CLI ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found