我正在尝试使用tensorflow.js运行我在python中创建的模型。该模型具有两个输入张量,一个为[1,60]形状,另一个为[1,60,1]。我正在这样做:
var array1 = new Array(60).fill(0);
var tensor1 = tf.tensor(arr1, [1, 60);
var array2 = new Array(60).fill(1);
var tensor2 = tf.tensor(arr2, [1, 60, 1]);
var tensorResult = model.predict([tensor1, tensor2]);
但是它给了我这个信息:
Error: Error when checking model : the Array of Tensors that you are passing to your model is not the size the the model expected.
Expected to see 2 Tensor(s), but instead got 1 Tensors(s).
在python中,以下内容非常适合我:
model.predict([tensor1, tensor2])
我将不胜感激。
谢谢!
错误说明了一切。
您传递给模型的张量数组不是模型预期的大小。
作为输入传递给模型的张量的形状不是模型所期望的