如何为 TensorFlow.js 设置 tSNE?

How to setup tSNE for TensorFlow.js?

我正在尝试 运行 我自己的 html/js 项目中的简单 tensorflow tfjs-tsne 示例 (https://github.com/tensorflow/tfjs-tsne)。 tensorflow 核心似乎已正确加载(例如 tf.randomUniform 调用有效),但只要我调用 tsne(例如 tsne.tsne(data)),我就会在浏览器控制台中收到此错误:

"Uncaught TypeError: n.ENV.findBackend is not a function" - 当包含在脚本标签中时,或者:

"TypeError: _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__.ENV.findBackend is not a function" - 当通过纱线包含时

我在设置这个项目时做错了什么?

tSNE 的最新版本来自 June 2018 and does currently not support the latest Tensorflow version (state: April 2019). There is already an opened issue on github and a statement from the author 此处。

您可以将脚本降级到旧版本的 Tensorflow 以使用 tSNE:

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.14.1"></script>