Yes, JuanFMontesinos, I used just what you told me.

Where f is sobel filter expanded to all 3 channels.
import torch
filter = torch.tensor([[1., 2. , 1.], [0., 0., 0.], [-1., -2. , -1.]])
f = filter.expand(1,3,3,3)