I receive the following error:
filtered_y_y = F.conv2d(y_c, sobel_y_filter, stride=1, padding=1)
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
The problem occurs, when I apply a sobel filter to a 2d feature map and run it on cuda. The code looks as follows:
def AbsDetJacobian(batch_meshgrid, device):
"""
:param batch_meshgrid: takes meshgrid tensor of dim [bn, 2, h, w] (conceptually meshgrid represents a two dimensional function f = [fx, fy] on [bn, h, w] )
:return: returns Abs det of Jacobian of f of dim [bn, 1, h, w]
"""
y_c = batch_meshgrid[:, 0, :, :].unsqueeze(1)
x_c = batch_meshgrid[:, 1, :, :].unsqueeze(1)
sobel_x_filter = 1 / 4 * torch.tensor([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]).reshape(1, 1, 3, 3).to(device)
sobel_y_filter = sobel_x_filter.permute(0, 1, 3, 2).to(device)
filtered_y_y = F.conv2d(y_c, sobel_y_filter, stride=1, padding=1)
filtered_y_x = F.conv2d(y_c, sobel_x_filter, stride=1, padding=1)
filtered_x_y = F.conv2d(x_c, sobel_y_filter, stride=1, padding=1)
filtered_x_x = F.conv2d(x_c, sobel_x_filter, stride=1, padding=1)
Det = torch.abs(filtered_y_y * filtered_x_x - filtered_y_x * filtered_x_y)
return Det
Does anyone have an idea what’s going on here?