Skip to content

Commit

Permalink
Merge branch 'keras-team:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidriasat authored Jul 19, 2023
2 parents a2117b4 + 2a645d3 commit a81609f
Show file tree
Hide file tree
Showing 58 changed files with 4,675 additions and 789 deletions.
731 changes: 731 additions & 0 deletions examples/nlp/ipynb/sentence_embeddings_with_sbert.ipynb

Large diffs are not rendered by default.

635 changes: 635 additions & 0 deletions examples/nlp/md/sentence_embeddings_with_sbert.md

Large diffs are not rendered by default.

461 changes: 461 additions & 0 deletions examples/nlp/sentence_embeddings_with_sbert.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion guides/customizing_what_happens_in_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"""

import tensorflow as tf
from tensorflow import keras
import keras

"""
## A first simple example
Expand Down
2 changes: 1 addition & 1 deletion guides/distributed_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"""

import tensorflow as tf
from tensorflow import keras
import keras

"""
## Single-host, multi-device synchronous training
Expand Down
11 changes: 7 additions & 4 deletions guides/functional_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Title: The Functional API
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2019/03/01
Last modified: 2020/04/12
Last modified: 2020/07/10
Description: Complete guide to the functional API.
Accelerator: GPU
"""
Expand All @@ -12,8 +12,8 @@

import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import keras
from keras import layers

"""
## Introduction
Expand Down Expand Up @@ -607,6 +607,7 @@ def call(self, inputs):
"""


@keras.saving.register_keras_serializable()
class CustomDense(layers.Layer):
def __init__(self, units=32):
super().__init__()
Expand Down Expand Up @@ -635,7 +636,7 @@ def get_config(self):
model = keras.Model(inputs, outputs)
config = model.get_config()

new_model = keras.Model.from_config(config, custom_objects={"CustomDense": CustomDense})
new_model = keras.Model.from_config(config)

"""
Optionally, implement the class method `from_config(cls, config)` which is used
Expand Down Expand Up @@ -776,6 +777,7 @@ def call(self, inputs):
model = keras.Model(inputs, outputs)


@keras.saving.register_keras_serializable()
class CustomRNN(layers.Layer):
def __init__(self):
super().__init__()
Expand Down Expand Up @@ -830,6 +832,7 @@ def call(self, inputs):
batch_size = 16


@keras.saving.register_keras_serializable()
class CustomRNN(layers.Layer):
def __init__(self):
super().__init__()
Expand Down
2 changes: 1 addition & 1 deletion guides/intro_to_keras_for_engineers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import numpy as np
import tensorflow as tf
from tensorflow import keras
import keras

"""
## Introduction
Expand Down
2 changes: 1 addition & 1 deletion guides/intro_to_keras_for_researchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import tensorflow as tf
from tensorflow import keras
import keras

"""
## Introduction
Expand Down
2 changes: 1 addition & 1 deletion guides/ipynb/customizing_what_happens_in_fit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"outputs": [],
"source": [
"import tensorflow as tf\n",
"from tensorflow import keras"
"import keras"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion guides/ipynb/distributed_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"outputs": [],
"source": [
"import tensorflow as tf\n",
"from tensorflow import keras"
"import keras"
]
},
{
Expand Down
11 changes: 7 additions & 4 deletions guides/ipynb/functional_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"\n",
"**Author:** [fchollet](https://twitter.com/fchollet)<br>\n",
"**Date created:** 2019/03/01<br>\n",
"**Last modified:** 2020/04/12<br>\n",
"**Last modified:** 2020/07/10<br>\n",
"**Description:** Complete guide to the functional API."
]
},
Expand All @@ -33,8 +33,8 @@
"source": [
"import numpy as np\n",
"import tensorflow as tf\n",
"from tensorflow import keras\n",
"from tensorflow.keras import layers"
"import keras\n",
"from keras import layers"
]
},
{
Expand Down Expand Up @@ -1064,6 +1064,7 @@
"outputs": [],
"source": [
"\n",
"@keras.saving.register_keras_serializable()\n",
"class CustomDense(layers.Layer):\n",
" def __init__(self, units=32):\n",
" super().__init__()\n",
Expand Down Expand Up @@ -1092,7 +1093,7 @@
"model = keras.Model(inputs, outputs)\n",
"config = model.get_config()\n",
"\n",
"new_model = keras.Model.from_config(config, custom_objects={\"CustomDense\": CustomDense})"
"new_model = keras.Model.from_config(config)"
]
},
{
Expand Down Expand Up @@ -1256,6 +1257,7 @@
"model = keras.Model(inputs, outputs)\n",
"\n",
"\n",
"@keras.saving.register_keras_serializable()\n",
"class CustomRNN(layers.Layer):\n",
" def __init__(self):\n",
" super().__init__()\n",
Expand Down Expand Up @@ -1324,6 +1326,7 @@
"batch_size = 16\n",
"\n",
"\n",
"@keras.saving.register_keras_serializable()\n",
"class CustomRNN(layers.Layer):\n",
" def __init__(self):\n",
" super().__init__()\n",
Expand Down
2 changes: 1 addition & 1 deletion guides/ipynb/intro_to_keras_for_engineers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"source": [
"import numpy as np\n",
"import tensorflow as tf\n",
"from tensorflow import keras"
"import keras"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion guides/ipynb/intro_to_keras_for_researchers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"outputs": [],
"source": [
"import tensorflow as tf\n",
"from tensorflow import keras"
"import keras"
]
},
{
Expand Down
Loading

0 comments on commit a81609f

Please sign in to comment.