Thank you for trying to help me. I used .expand() to get a batch of adv_patch images, of the size [N, M, C, H, W] where N is the number of images in my batch I should apply the patch on, and M is the number of detections per image in my batch. The problem I’m facing right now is that i would like to rotate the images in my adv_patch batch, but each give them a different (random) rotation.
I also have to resize each of these images to a specific size, defined in another tensor.
Thanks for sharing your code for a batched rotation. I used the code of your answer in another thread 43 to rotate a single tensor. The problem I’m facing is that I have to give a different rotation to each of the  adv_patch images in my batch. I made a tensor the same size of my batch, containing random angles in [0, 2*pi]. How can i do the rotation taking as input the batch of adv_patch  images and the batch of rotations and giving me a batch of adv_patch images, each one rotated along the angles in the rotation batch? Is it possible on a batch level or should i use a loop for that?