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 gfg = tf.sequential();
const layer = tf.layers.dense({units:1,
inputShape : [8]});
gfg.add(layer);
const config = {optimizer:
'sgd'
,
loss:
'meanSquaredError'
};
gfg.compile(config);
const res = await gfg.evaluateDataset(Dataset_xy,
tf.ones([7, 10]), tf.ones([7, 1]), {
batchSize: 5,
});
res.print();