I know this is a little late, but just in case you are still looking into this I wanted to share what I see in the error. It looks like your issue is not the batch size, but rather the “aten::uniform” operator in one of your layers. You can check here 35 for supported operators and/or how to add aten operators.