Keras 函数式 API 的语法 [英] Syntax of Keras Functional API

查看:24
本文介绍了Keras 函数式 API 的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 keras 函数式 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)

据我所知,Conv2d 是一个.Conv2d()() 语法在 python 中是如何工作的?

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

推荐答案

Conv2d(...).(X) 等价于:

layer = Conv2d(...)
X = layer(X)

其中 layer() 等价于 layer.__call__(self,....).

这篇关于Keras 函数式 API 的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆