ES6 Module Import of Tensorflow no longer works
See original GitHub issueTo get help from the community, we encourage using Stack Overflow and the tensorflow.js
tag.
TensorFlow.js version
Tensorflow Core 2.1.0
Browser version
Doesn’t matter, but Chrome 85
Describe the problem or feature request
Previously, with Tensorflow (ex 1.3.2), I could use ES6 module imports along with a simple bare-module resolving server like es-dev-server (https://www.npmjs.com/package/es-dev-server), or quite possibly the Chrome only import maps.
Unfortunately, now, that’s not possible. It looks like the newer dependency tfjs-backend-cpu
contains a seedrandom
import, and this module is not a proper ES6 import (uses require() for importing). Perhaps this small module could be bundled as an ES6 import prior to shipping such that it all works again?
thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Cannot use import statement outside a module when trying to ...
I ran npm install @tensorflow/tfjs like explained here which worked; I tried to import it like so: import * as tf from '@tensorflow/tfjs';....
Read more >TensorFlow.js in Node
When importing TensorFlow.js from this package, the module that you get will be accelerated by the TensorFlow C binary and run on the...
Read more >Error when importing TensorFlow | Apple Developer Forums
When I try to import tensorflow: import tensorflow. I get the following error: RuntimeError: module compiled against API version 0xe but this version...
Read more >How to use an ES6 import in Node.js? - GeeksforGeeks
Node has experimental support for ES modules. To enable them we need to make some changes to the package.json file. Before following the...
Read more >import "tensorflow.keras.models" could not be resolved
AttributeError: module 'os' has no attribute 'envirion'. It can be resolved if you can correct spell to environ. Working code as shown below....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is still an issue.
Using Angular (webpack), it is possible to import, but the following message is given:
tfjs 3.16.0
Here’s the branch where I’m working on this. If you want to try it locally, you can build local npm packages from it by running
yarn build
inlink-package
. The outputs show up inlink-package/node_modules/@tensorflow/
.