Solved by Zhihao_Wu in post #3 
              
              
                Hi @ptrblck, you’re right. I answer this question on stackoverflow, How to do batch filling in pytorch. But looks like for-loop isn’t very efficient. Any ideas of improvement?