Running model on each element in model within batch

I was trying within a function definition run a specific operation on each element in the batch. This operation has to be performed independently(ie it can’t be run on the whole batch at once.) I tried using for loops, map functions, for in range loops.
I have attached a mini colab. I put a dummy function here, but in reality it won’t work across the batch.
Any strategies that would be helpful would be great.
Google Colab.