Computing a for loop over the same network is equivalent to do a siamese network of 128 branches. Anyway you are doing something very strange which is concatenating after each for loop which is incorrect. The second way is better.
If you get out of memory… it means you need more memory, that’s all