開始使用免費開始

輸入層

建立神經網路模型的第一步是定義「輸入」(Input)層。這個層會接收原始資料,通常是 numpy 陣列。輸入層的形狀(shape)決定你的神經網路會使用多少個變數。舉例來說,如果輸入資料有 10 個欄位,你就定義一個形狀為 (10,) 的輸入層。

在這個情境中,你的網路只會使用一個輸入。

本練習屬於課程

使用 Keras 的進階深度學習

檢視課程

練習說明

  • keras.layers 匯入 Input 層的函式。
  • 建立一個形狀為 1 的輸入層。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Import Input from tensorflow.keras.layers
____

# Create an input layer of shape 1
input_tensor = ____(shape=(____,))
編輯並執行程式碼