Let’s see the popular example from Part 2 of the course, with the annealer decorator. We have the following function:
def _inner(start, end):
return partial(f, start, end)
Then I want to decorate a function with the annealer, so:
def linear_scheduler(start, end, position):
return start + position * (end - start)
But when I build the documentation I get the following result with an example:
Also, the table of contents displays it like this:
Is this a bug or is there something eluding me?
You should either have your decorator fix the function name in the signature (look at the fastcore decorators for inspiration) or you can write the
show_doc cell yourself and use the name argument to pass the name you want:
@sgugger Could you give an example of how to have my decorator fix the function name, or where to look in fastcore exactly?
Thanks a lot!
Like I said, look at the decorators defined in fastcore. I think the important line is