|
109 | 109 | "outputs": [],
|
110 | 110 | "source": [
|
111 | 111 | "import tensorflow as tf\n",
|
112 |
| - "from tensorflow.keras.layers.experimental import preprocessing \n", |
113 | 112 | "\n",
|
114 | 113 | "import tensorflow_datasets as tfds"
|
115 | 114 | ]
|
|
247 | 246 | " def __init__(self, seed=42):\n",
|
248 | 247 | " super().__init__()\n",
|
249 | 248 | " # both use the same seed, so they'll make the same random changes.\n",
|
250 |
| - " self.augment_inputs = preprocessing.RandomFlip(mode=\"horizontal\", seed=seed)\n", |
251 |
| - " self.augment_labels = preprocessing.RandomFlip(mode=\"horizontal\", seed=seed)\n", |
| 249 | + " self.augment_inputs = tf.keras.layers.RandomFlip(mode=\"horizontal\", seed=seed)\n", |
| 250 | + " self.augment_labels = tf.keras.layers.RandomFlip(mode=\"horizontal\", seed=seed)\n", |
252 | 251 | " \n",
|
253 | 252 | " def call(self, inputs, labels):\n",
|
254 | 253 | " inputs = self.augment_inputs(inputs)\n",
|
|
310 | 309 | " for i in range(len(display_list)):\n",
|
311 | 310 | " plt.subplot(1, len(display_list), i+1)\n",
|
312 | 311 | " plt.title(title[i])\n",
|
313 |
| - " plt.imshow(tf.keras.preprocessing.image.array_to_img(display_list[i]))\n", |
| 312 | + " plt.imshow(tf.keras.utils.array_to_img(display_list[i]))\n", |
314 | 313 | " plt.axis('off')\n",
|
315 | 314 | " plt.show()"
|
316 | 315 | ]
|
|
0 commit comments