Complete the code to create a simple TensorFlow.js tensor.
const tensor = tf.[1]([1, 2, 3, 4]);
The tf.tensor1d function creates a 1-dimensional tensor from the given array.
Complete the code to define a sequential model in TensorFlow.js.
const model = tf.[1]();modelSequential.The tf.sequential() function creates a new sequential model in TensorFlow.js.
Fix the error in the code to add a dense layer with 10 units and ReLU activation.
model.add(tf.layers.dense({units: [1], activation: 'relu'}));The units parameter expects a number, not a string. So use 10 without quotes.
Fill both blanks to compile the model with optimizer 'adam' and loss 'meanSquaredError'.
model.compile({optimizer: '[1]', loss: '[2]'});Use adam as the optimizer and meanSquaredError as the loss function for regression tasks.
Fill all three blanks to train the model with data tensors xTrain and yTrain for 5 epochs and batch size 32.
await model.fit([1], [2], {epochs: [3], batchSize: 32});
Use xTrain as input data, yTrain as labels, and train for 5 epochs.
