Add kwargs to constructor of custom model

main
Aurélien Geron 2019-02-28 19:48:50 +08:00
parent ed5c7d6db8
commit e938df8fb9
1 changed files with 2 additions and 2 deletions

View File

@ -1054,8 +1054,8 @@
"outputs": [],
"source": [
"class WideAndDeepModel(keras.models.Model):\n",
" def __init__(self, units=30, activation=\"relu\"):\n",
" super().__init__()\n",
" def __init__(self, units=30, activation=\"relu\", **kwargs):\n",
" super().__init__(**kwargs)\n",
" self.hidden1 = keras.layers.Dense(units, activation=activation)\n",
" self.hidden2 = keras.layers.Dense(units, activation=activation)\n",
" self.main_output = keras.layers.Dense(1)\n",