元编程参考文档

Keras 层

10 个节点

本页内容 10

相加

函数

Adds several branches of the same shape, element by element, as a residual connection does.

签名
相加(输入: KerasTensor 数组) -> KerasTensor
KerasTensor Add(KerasTensor[] inputs)

参数

名称类型默认值说明
输入KerasTensor 数组—The branches.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

批归一化

函数

Rescales its inputs to a steady mean and spread, batch by batch, which makes deeper networks train faster.

签名
批归一化(输入: KerasTensor) -> KerasTensor
KerasTensor BatchNormalization(KerasTensor input)

参数

名称类型默认值说明
输入KerasTensor—The tensor before.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

拼接

函数

Joins several branches side by side, along their last axis.

签名
拼接(输入: KerasTensor 数组) -> KerasTensor
KerasTensor Concatenate(KerasTensor[] inputs)

参数

名称类型默认值说明
输入KerasTensor 数组—The branches.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

二维卷积

函数

A 2D convolution: small filters slid over a picture-shaped input (height, width, channels), each finding one kind of pattern.

签名
二维卷积 -> KerasTensor
    输入: KerasTensor
    滤波器数: 整数
    卷积核大小: 整数
    激活函数: 文本
KerasTensor Conv2D(
    KerasTensor input,
    int filters,
    int kernelSize = 3,
    string activation = "relu")

参数

名称类型默认值说明
输入KerasTensor—The tensor before, shaped height, width, channels.
滤波器数整数—How many filters, which is how many channels the output has.
卷积核大小整数3Each filter's width and height in pixels.
激活函数文本relurelu, sigmoid...; empty for none.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

全连接层

函数

A fully connected layer: every output is a weighted sum of every input, then the activation.

签名
全连接层 -> KerasTensor
    输入: KerasTensor
    单元数: 整数
    激活函数: 文本
KerasTensor Dense(
    KerasTensor input,
    int units,
    string activation)

参数

名称类型默认值说明
输入KerasTensor—The tensor before.
单元数整数—How many outputs.
激活函数文本—relu, sigmoid, softmax, tanh, gelu...; empty for none (a linear output).

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

随机失活

函数

Drops a share of its inputs at random while training, against overfitting; does nothing when predicting.

签名
随机失活(输入: KerasTensor, 比率: 数字) -> KerasTensor
KerasTensor Dropout(KerasTensor input, double rate = 0.2)

参数

名称类型默认值说明
输入KerasTensor—The tensor before.
比率数字0.2The share dropped, between 0 and 1.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

展平

函数

Lays a shaped input out as one row of numbers, as a Dense layer after convolutions needs.

签名
展平(输入: KerasTensor) -> KerasTensor
KerasTensor Flatten(KerasTensor input)

参数

名称类型默认值说明
输入KerasTensor—The tensor before.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

输入

函数

Where data enters the network: one example's shape, without the batch.

签名
输入(形状: 整数数组, 名称: 文本, 种子: 整数) -> KerasTensor
KerasTensor Input(int[] shape, string name, int seed = -1)

参数

名称类型默认值说明
形状整数数组—The shape of one example, such as 4 for four numbers or 28, 28, 1 for a small grey picture.
名称文本—A name for the input; empty for Keras's own.
种子整数-1The seed the starting weights of the layers drawn after this input come from, as keras.utils.set_random_seed sets it; negative leaves them random.

返回

张量KerasTensor

备注

Layers draw their starting weights as they are joined to the network, which happens after the Input they hang from, so seeding here makes the whole network's start repeatable.

所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

层归一化

函数

Rescales each example's features to a steady mean and spread.

签名
层归一化(输入: KerasTensor) -> KerasTensor
KerasTensor LayerNormalization(KerasTensor input)

参数

名称类型默认值说明
输入KerasTensor—The tensor before.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习

二维最大池化

函数

Halves a picture-shaped input's width and height (by default), keeping the strongest value of each patch.

签名
二维最大池化(输入: KerasTensor, 池化大小: 整数) -> KerasTensor
KerasTensor MaxPooling2D(KerasTensor input, int poolSize = 2)

参数

名称类型默认值说明
输入KerasTensor—The tensor before, shaped height, width, channels.
池化大小整数2The patch's width and height.

返回

张量KerasTensor
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
Keras 层
所属包
机器学习