Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

Syntax of Keras Functional API

I am kinda confused on how the syntax in the keras functional API works. Its really useful to define complex multi input and output models. But the syntax is kinda puzzling for me.

new_layer = Conv2d(...)(old_layer)

as far as I know the Conv2d is a class. How does Conv2d()() syntax work in python?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Every object in python that implements a __call__() method can be called directly (you can take a look at this question or this tutorial). All keras layers implement this function (see source) and the implementation is supposed to return output of the layer given the input tensor.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...