Code Monkey home page Code Monkey logo

Comments (4)

srush avatar srush commented on July 21, 2024 1

Order of the vars does matter here. Backward returns correspond to forward arg order.

from module-1.

srush avatar srush commented on July 21, 2024

These functions are a bit confusing and should have more clear naming.

However, that test is correct. If you look at the backward it is calling you can see that it just passes d_output back. which is 5.

class Temp(minitorch.FunctionBase):
    "Implements additions"

    @staticmethod
    def backward(ctx, d_output):
        return d_output, d_output

from module-1.

ionuttamas avatar ionuttamas commented on July 21, 2024

@srush
But this is not true, as the function is Temp2 (not Temp1) at the line 53 assert:

`class Temp2(minitorch.FunctionBase):
"Implements additions"

@staticmethod
def backward(ctx, d_output):
    x = ctx.saved_values
    return d_output, x * d_output`

and that's why I think it should be 5 * 10 (as in the line 45 assert); this should be true regardless as is the same function, just the order of parameters change compared to the line 45 assert.

from module-1.

srush avatar srush commented on July 21, 2024

Oh sorry I read the wrong line.

On line 53 it is temp2, but the var is switched. It's the first one (not times x). Constants are dropped.

from module-1.

Related Issues (7)

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.