How to run tensorflow model twice before computing the loss
So, as in comment:

Put as many inputs in the batch as you want, and the run prediction on that batch. That way, you could use all outputs to calculate the loss function.

Keras

In Keras framework, if you want to calculate the mean_absolute_error as you state in your question, you could use predefined mean_absolute_error loss. Also, to have two inputs as you state in your question, specify the batch size of the model to 2.