X = layers.Flatten()(last_output)

Why in this case is the syntax being used in this way?

Is there another form for write this code?

Have a look on this post: Python Calling

Hi, @lywhlao!

As @gent.spah indicates with that post, layers.Flatten() creates a function, so the next parenthesis calls it:

layers.Flatten()(last_output)

is equivalent to:

f = layers.Flatten() # Creates object with no explicit arguments
f(last_output) # Function call

1 Like