W2_C6: Can someone help me understand the logic of tl.Fn?

He everyone!

I seemed to be stuck on simple yet important piece of assignment:
In feed_forward statement after dense layer I pass
tl.Fn(‘Activation Function’,ff_activation(), n_out=1), but it gives me an error saying that function has default arguments.

I know I need to look through the trax layers logic and OOP of Python to get it, but maybe someone can explain in simple words what I am doing wrong?

Thank you in advance

Hi @Snapikk

You are a little bit overthinking :slight_smile: . Take a look at the docstring of the DecoderBlock:


Args:

ff_activation (function): the non-linearity in feed-forward layer.

Note that the argument of ff_activation parameter is a function - that means you just have to use it (and not to re-create it).

Also, the code hint says the same thing:

# Add activation function passed in as a parameter (you need to call it!)

In simple words, this is just ff_activation() item in the list.

Cheers

1 Like

Thanks! I wrote tl.Fn and thought it was in a code before, was hitting this wall for four:)

1 Like