Skip to content

Weird error when backprop though grid sample #2307

@ruotianluo

Description

@ruotianluo
import torch
x = torch.cuda.FloatTensor(1, 1, 16384, 16384)
x = torch.autograd.Variable(x, requires_grad=True)
y = x.expand(2, x.size(1), x.size(2), x.size(3))
grid = torch.rand(2, 1, 1, 2)
import torch.nn.functional as F
z = F.grid_sample(y, torch.autograd.Variable(grid.cuda()))
z.sum().backward()

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/data/vision-greg/rluo/local/anaconda/lib/python2.7/site-packages/torch/autograd/variable.py", line 156, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
  File "/share/data/vision-greg/rluo/local/anaconda/lib/python2.7/site-packages/torch/autograd/__init__.py", line 98, in backward
    variables, grad_variables, retain_graph)
  File "/share/data/vision-greg/rluo/local/anaconda/lib/python2.7/site-packages/torch/autograd/function.py", line 91, in apply
    return self._forward_cls.backward(self, *args)
  File "/share/data/vision-greg/rluo/local/anaconda/lib/python2.7/site-packages/torch/autograd/function.py", line 194, in wrapper
    outputs = fn(ctx, *tensor_args)
  File "/share/data/vision-greg/rluo/local/anaconda/lib/python2.7/site-packages/torch/nn/_functions/vision.py", line 48, in backward
    grad_output)
RuntimeError: CUDNN_STATUS_BAD_PARAM

It works fine when running under cpu mode.
It works also fine when replacing last line with z.backward(z.data.clone().fill_(1))

torch version 0.2.0_1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions