TensorflowJS backend CPU kernel undefined is already registered

Viewed 1004

I am loading the TensorFlowJS library and backend GPU with these script tags:

<script defer src="https://unpkg.com/@tensorflow/tfjs-core@2.1.0/dist/tf-core.js"></script>
<script defer src="https://unpkg.com/@tensorflow/tfjs-converter@2.1.0/dist/tf-converter.js"></script>
<script defer src="https://unpkg.com/@tensorflow/tfjs-backend-webgl@2.1.0/dist/tf-backend-webgl.js"></script>

This works, but it gives me this warning in the console:

Your application contains ops that are small enough to be executed on the CPU backend, however the CPU backend cannot be found. Consider importing the CPU backend (@tensorflow/tfjs-backend-cpu) for better performance.

BUT when I load the backend CPU with this tag:

<script defer src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu"></script>

I get these errors:

kernel_registry.ts:142 The kernel 'undefined' for backend 'cpu' is already registered

And

backend.ts:665 Uncaught (in promise) Error: 'realDivide' not yet implemented or not found in the registry. 
Did you forget to import the kernel?
    at notYetImplemented (backend.ts:665)

If I load both GPU and CPU, I only get the kernel undefined is already registered warning.

Some other posts here on SO and GitHub say that some libraries are probably loaded twice? But I can't leave out any of these script tags...

0 Answers
Related