Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【论文复现】grid_sample反向传播出错 #38900

Closed
IcarusWizard opened this issue Jan 12, 2022 · 2 comments
Closed

【论文复现】grid_sample反向传播出错 #38900

IcarusWizard opened this issue Jan 12, 2022 · 2 comments
Assignees

Comments

@IcarusWizard
Copy link
Contributor

  • 标题:grid_sample反向传播出错
  • 版本、环境信息:
       1)PaddlePaddle版本:2.2.1
       2)系统环境:AI Studio
import paddle
import paddle.nn.functional as F
import numpy as np

# shape=[1, 1, 3, 3]
x = np.array([[[[-0.6,  0.8, -0.5],
                [-0.5,  0.2,  1.2],
                [ 1.4,  0.3, -0.2]]]]).astype(np.float32)

# grid shape = [1, 3, 4, 2]
grid = np.array(
                [[[[ 0.2,  0.3],
                [-0.4, -0.3],
                [-0.9,  0.3],
                [-0.9, -0.6]],
                [[ 0.4,  0.1],
                [ 0.9, -0.8],
                [ 0.4,  0.5],
                [ 0.5, -0.2]],
                [[ 0.1, -0.8],
                [-0.3, -1. ],
                [ 0.7,  0.4],
                [ 0.2,  0.8]]]]).astype(np.float32)


x = paddle.to_tensor(x)
grid = paddle.to_tensor(grid)

x.stop_gradient = True
grid.stop_gradient = True
y_t = F.grid_sample(x, grid, mode='bilinear', padding_mode='border', align_corners=True) # pass

x.stop_gradient = False
grid.stop_gradient = False
y_t = F.grid_sample(x, grid, mode='bilinear', padding_mode='border', align_corners=True).mean().backward() # pass

x.stop_gradient = False
grid.stop_gradient = True
y_t = F.grid_sample(x, grid, mode='bilinear', padding_mode='border', align_corners=True).mean().backward() # pass

x.stop_gradient = True
grid.stop_gradient = False
y_t = F.grid_sample(x, grid, mode='bilinear', padding_mode='border', align_corners=True).mean().backward() # error

"""
RuntimeError: (NotFound) No Output(X@GRAD) found for grid_sampler operator.
  [Hint: Expected ctx->HasOutput(framework::GradVarName("X")) == true, but received ctx->HasOutput(framework::GradVarName("X")):0 != true:1.] (at /paddle/paddle/fluid/operators/grid_sampler_op.cc:183)
"""
@paddle-bot-old
Copy link

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

@IcarusWizard IcarusWizard changed the title grid_sample反向传播出错 【论文复现】grid_sample反向传播出错 Jan 17, 2022
@wanghaoshuang wanghaoshuang self-assigned this Jan 17, 2022
@paddle-bot paddle-bot bot closed this as completed Jan 24, 2023
@paddle-bot
Copy link

paddle-bot bot commented Jan 24, 2023

Since you haven't replied for more than a year, we have closed this issue/pr.
If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up.
由于您超过一年未回复,我们将关闭这个issue/pr。
若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants