import * as tf from
"@tensorflow/tfjs"
const Array_x = [
[1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
];
const Array_y = [1, 1, 1, 1];
const Dataset_x = tf.data.array(Array_x);
const Dataset_y = tf.data.array(Array_y);
const Dataset_xy = tf.data.zip({xs: Dataset_x, ys: Dataset_y})
.batch(5)
.shuffle(3);
const mymodel = tf.sequential({
layers: [tf.layers.dense({units: 1, inputShape: [8]})]
});
mymodel.compile({optimizer:
'sgd'
, loss:
'meanSquaredError'
});
const res = await mymodel.evaluateDataset(Dataset_xy,
tf.ones([7, 10]), tf.ones([7, 1]), {
batchSize: 5,
});
res.print();