Hi Adam,
I am trying to implement this in pytorch now, but i am not getting the right performance.
If you would guide me in the right direction, I would be grateful.
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as nnf
import time

image = torch.randn(512, 512)
image = Variable(image.view(1,1,512, 512))

u = torch.Tensor([1,2,1])
v = torch.Tensor([-1, 0, 1])
w = Variable(torch.ger(u, v))
w = w.view(1,1,3,3)

u = Variable(u.view(1,1,3,1))
v = Variable(v.view(1,1,1,3))

t = time.time()
res1 = nnf.conv2d(image, u, stride=1, padding=1)
out = nnf.conv2d(res1, v, stride=1)
print "time taken is {}".format(time.time()-t)
print out

t = time.time()
out1 = nnf.conv2d(image, w, stride=1, padding=1)
print "time taken by normal is {}".format(time.time()-t)
print out1