What is the difference between concatenating two image and passing it through resnet network ,while passing both images individually to the network. Code 1 for 1st scenario and code 2 for second.
I think in code 1, you are concatenating 2 batches of Images, so if there is enough RAM, than it will work fine.
In second code you are running model twice, so more time for same work.
Here only thing to take care is whether you have the capacity to sent 256 Batch Size to model or not, if yes than you can use code1 which will run all 256 images in parallel.