Hi, I’m trying to create a simple example to work with the lstm model
It’s not working, can you tell me what the problem is?
const model = tf.sequential();
const LSTM = tf.layers.lstm({units: 2, returnSequences: true});
const input = tf.input({shape: [5, 2]});
const output = LSTM.apply(input);
model.add(LSTM);
model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});
console.log(JSON.stringify(input.shape));
console.log(JSON.stringify(output.shape));
const xs = tf.tensor2d( [ [1,2,3,4,5], [2,3,4,5,6] ] ).print();
const ys = tf.tensor2d( [ [2,3,4,5,6], [3,4,5,6,7] ] ).print();
await model.fit(xs, ys, { epochs: 200, verbose: 0, callbacks: {
onEpochEnd: async (epoch, logs)=>{
console.log(logs)
}
}});