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.

`console.log(tf.getBackend())` reports undefined before using any operations.

See original GitHub issue

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version

1.1.2

Browser version

chomre 74

Describe the problem or feature request

console.log(tf.getBackend()) reports undefined before using any operations.

Code to reproduce the bug / link to feature request

https://github.com/QuantumInformation/tensorflowjs-playground/blob/master/src/Playground.ts#L4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
dmnsgncommented, Mar 29, 2021

Waiting for await tf.ready() helps.

3reactions
nsthoratcommented, Jun 17, 2019

This is kind of expected because it’s technically the truth.

However, from the user’s point of view this definitely seems wrong. We can solve this by initializing the backend when the user calls that, just as calling tf.backend() would.

Technical details: Backends are initialized lazily. Only when you call an op do we find the best backend and initialize it. We do this for a few of the engine methods, e.g. tf.backend(), tf.findBackend(name), etc. We should probably do it for this one too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'info' and 'history' are undefined in tensorflow.js's model
I'm trying to build simple machine learning model using tensorflow.js library in my expo project.
Read more >
Tensorflow.js tf.getBackend() Function - GeeksforGeeks
The tf.getBackend() function is used to return the current backend name. Syntax: tf.getBackend(). Parameters:.
Read more >
Creates a tf.Tensor with the provided values, shape and dtype.
This function returns the shape of the result of an operation between two tensors of size s0 and s1 performed with broadcast. Parameters:...
Read more >
UNPKG - @tensorflow/tfjs-core
@tensorflow/tfjs-core/dist/tf-core.js.map ... sizeFromShape(shape);\n * console.log(size);\n * ```\n *\n * @doc ... timerAvailable()) {\n timer = this.
Read more >
Viewing online file analysis results for 'miner.js'
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to ...
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