I wonder why my neural network give me n predictions for single sample. I was expecting to get only one prediction if I pass only one sample with size of input of neural network input layer, but I am always getting as many predictions as my input vector length. For example, if I have a neural-network which input layer size is 3, and I pass a vector with 3 values, I will get 3 predictions (each with size of my output layer size). Why is it like that, and what should I change to get only one prediction?
function createNetwork(inputSize, outputSize) {
  const model = tf.sequential();
  model.add(
    tf.layers.dense({
      units: inputSize,
      inputShape: [1],
      activation: 'relu'
    })
  );
  model.add(
    tf.layers.dense({
      units: 16,
      activation: 'relu'
    })
  );
  model.add(
    tf.layers.dense({
      units: outputSize
    })
  );
  model.compile({
    loss: 'meanSquaredError',
    optimizer: 'adam'
  });
  return model;
}

const network = createNetwork(3, 2);
const sample = tf.tensor1d([1, 2, 3]);
const prediction = network.model.predict(sample).arraySync();
console.log(prediction)


In this example, I have created a neural network with input layer of size 3 and output layer of size 2 then I have passed a vector with 3 variables and get 3 predictions (3×2 matrix insted 1x2 matrix)

Live demo 1