元編程參考文件

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 層
所屬包
機器學習