Skip to content

@mugrade.local_tests decorator prevents recursion #1

@joergneulist

Description

@joergneulist

I found this during HW1 of the Modern AI Course. I solved problem 10 using recursion, i.e. by having batch_matmul() call itself. This doesn't work, missing the function itself.

Presumably this happens because the test decorator makes the test execute before the def command is completed, so the function is never added to the global symbol table. The test fails, then, so the function isn't defined afterwards either. Normally it is defined afterwards, as proven by the ability to call prior exercises from later ones.

The work-around is to remove the decorator, execute the cell once, then add the decorator again - with the caveat, that you need to do this again for further changes to the code, because otherwise you get an obsolete version of the function in the global symbol table.

It would be nice, to have the function defined before it is executed.

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