tfjs: ES6 Module Import of Tensorflow no longer works

To 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!

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

This is still an issue.


Using Angular (webpack), it is possible to import, but the following message is given: tfjs 3.16.0

Warning: \node_modules@tensorflow\tfjs-backend-cpu\dist\kernels\Multinomial.js depends on ‘seedrandom’. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: \node_modules@tensorflow\tfjs-core\dist\ops\rand_util.js depends on ‘seedrandom’. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies