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.

"cpu backend was already registered" during import/require tfjs + tfjs-node-gpu

See original GitHub issue

TensorFlow.js version

0.13.0 tfjs-node-gpu 0.1.17

Browser version

N/A - Node 10.10

Describe the problem or feature request

require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node-gpu');

or

require('@tensorflow/tfjs-node-gpu');
require('@tensorflow/tfjs');

print the warning:

cpu backend was already registered. Reusing existing backend

It’s very minor ofc but damn annoys much.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:30 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
nsthoratcommented, Mar 12, 2019

This could be an issue with double importing of tfjs.

Can you show what your package.json dependencies look like? You don’t need to import @tensorflow/tfjs directly, @tensorflow/tfjs-node will do that for you.

1reaction
obenjirocommented, Oct 3, 2018

Changing package.json to this: (excluding @tensorflow/tfjs)

"dependencies": {
    "@tensorflow/tfjs-node": "^0.1.17"
}

Running npm install and using

import * as tf from "@tensorflow/tfjs";
import "@tensorflow/tfjs-node";

fixes the issue for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Platform node has already been set. Overwriting the platform ...
Trying to convert my computer vision application with tfjs-node to use ... The kernel '_FusedMatMul' for backend 'cpu' is already registered ...
Read more >
cpu backend was already registered as global error
I tried building from the source tfjs-layers so I could see changes I have made to the code, however following this series of...
Read more >
TensorflowJS backend CPU kernel undefined is already ...
If I load both GPU and CPU, I only get the kernel undefined is already registered warning. Some other posts here on SO...
Read more >
@tensorflow/tfjs-node - npm
This repository provides native TensorFlow execution in backend JavaScript ... npm install @tensorflow/tfjs-node-gpu (or) yarn add ...
Read more >
Machine Learning In Node.js With TensorFlow.js
This allows TensorFlow.js to be used in backend JavaScript applications ... or... npm install @tensorflow/tfjs @tensorflow/tfjs-node-gpu.
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