Tensorflow.js : TypeError : backend.select is not a function

Tensorflow.js : TypeError : backend.select is not a function

我正在使用 tensorflow.js 制作颜色分类器。训练的方法是在 canvas 中显示一种颜色,并且有 10 个按钮与 10 种颜色相关联,用户需要单击其中任何一个按钮才能显示 select 颜色。从按钮中获取输入,标准化颜色并应用 tf.oneHot,张量看起来像这样。 rgb 颜色和标签

Tensor
     [[0.772549, 0.3568628, 0.9098039],]
Tensor
     [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],]

然后我们取颜色并训练模型。每次用户单击按钮时,模型都会得到训练并变得更好。这是我的模型配置

const model = tf.sequential();

const hidden = tf.layers.dense({
    units: 16,
    inputShape: [3],
    activation: "relu"
});
model.add(hidden);
const output = tf.layers.dense({
    units: 10,
    activation: "softmax"
});
model.add(output);

const optimizer = tf.train.sgd(0.25);
model.compile({
    optimizer: optimizer,
    loss: "categoricalCrossentropy",
    metrics: ["accuracy"]
});

现在我收到一个名为 TypeError: backend.select is not a function 的错误,如果有人能告诉我这个错误的实际含义,那就太好了。

根据 this GitHub issue,这似乎是 tfjs-node 版本 0.1.9 中的问题。

快速npm update更新为0.1.10,似乎解决了问题!