GithubHelp home page GithubHelp logo

Comments (3)

GoogleGu avatar GoogleGu commented on May 3, 2024 4

image
箭头指的是不是应该改成grad_output*ctx.constant

我也觉得是这样,MulConstant的行为应该与内置的乘法行为一致,运行以下代码
a = torch.rand(3, 3, requires_grad=True)
b = a * 5
b.backward(torch.ones_like(a))
a.grad
得到的结果是3乘3值为5的tensor,MulConstant的例子得到的应该也是同样的tensor,应该是需要把ctx.constant乘在grad_output上的。

from pytorch-handbook.

zizhang-qiu avatar zizhang-qiu commented on May 3, 2024

我也觉得是这样

from pytorch-handbook.

Night-Quiet avatar Night-Quiet commented on May 3, 2024

这一步我个人感觉是这样的, 因为这是一个自定义的Autograd, 所以这个backward其实就是一种自定义, 自定义一种反向传播的梯度计算方法, 当backward完全和forward相同是就没必要重写这个, 而有时候我们更新梯度的时候, 是有一定的取舍和更改, 这里就是在梯度计算的时候, 舍弃constant的影响
当然, 我也觉得作者应该进行一定的解释

from pytorch-handbook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.