I'm trying to build a simple deep lstm neural network. I'm not much experienced with machine learning in general. But I do know some basics. This is my sample model.
const model = tf.sequential();
const {layers} = tf;
model.add(layers.lstm({
units : 256,
inputShape : [1, 6],
activation : "relu",
returnSequences : true,
}));
model.add(layers.dropout({rate: 0.2}));
model.add(layers.batchNormalization());
model.add(layers.lstm({
units : 128,
activation : "relu",
returnSequences : true,
}));
model.add(layers.dropout({rate: 0.2}));
model.add(layers.batchNormalization());
model.add(layers.lstm({
units : 128,
activation : "relu",
}));
model.add(layers.dropout({rate: 0.2}));
model.add(layers.batchNormalization());
model.add(layers.dense({
units : 32,
activation : "relu",
}));
model.add(layers.dropout({rate: 0.2}));
model.add(layers.dense({
units : 2,
activation : "softmax",
}));
model.compile({
//loss : "sparseCategoricalCrossentropy",
loss : "categoricalCrossentropy",
optimizer : tf.train.adam(0.001),
metrics : ['acc']
});
And when I trying to train the model I got this error.
const result = await model.fit(tf.ones([1, 1, 6]), tf.ones([1, 2]));
Error: Argument tensors passed to stack must be a `Tensor[]` or `TensorLike[]`
I found a thread about bug on github. But I don't think this is tfjs bug. Because that thread was more than a year ago. If it was a bug I'm pretty sure google fixed already. I think I did something wrong here. Also I tried exact same model in python and it's working fine... But I don't want to use python. I quit python many years ago since nodejs came out. I love javascript more than python and which is much easier to me maintaining. Can you help me understand what is wrong here?