Skip to content

2.3.3梯度结果问题请教 #174

Open
@zthcool

Description

bug描述
在按照教程2.3.3梯度章节中

再来反向传播一次,注意grad是累加的

out2 = x.sum()
out2.backward()
print(x.grad)

时我的返回结果是
tensor([[1., 1.],
[1., 1.]])
如图
image
请问是我的输入有问题么?

版本信息
pytorch: 1.9.0
torchvision: 0.10.0
torchtext: None
...

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions