I would like to be able to apply a function which is designed for a 3D tensor to each 3D tensor in a 4D tensor, namely image.translate()
. For example, I can apply the function individually to two images of dimension (3,50,50) but it would be great if I could feed their 4D concatenation of (2,3,50,50).
This could probably be done in a for loop but I was wondering if there was any built in function for this. Thanks.
I haven't managed to find such a function in
Torch
. You can, of course, define one yourself to make your life a little bit happier:Example: