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

Created on 17 Jun 2019  路  4Comments  路  Source: tensorflow/tfjs

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

core bug

Most helpful comment

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.

All 4 comments

This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there.

Re-opening as this might be a bug.

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.

Closing this due to lack of activity, feel to reopen. Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Arturbarth picture Arturbarth  路  3Comments

lastnod picture lastnod  路  3Comments

chrisdonahue picture chrisdonahue  路  3Comments

ritikrishu picture ritikrishu  路  4Comments

take-kuma picture take-kuma  路  3Comments