Skip to content

Commit b250421

Browse files
author
Yuval Fernbach
committed
rollback to TF 1.12
1 parent c5f13b7 commit b250421

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

0_Running_TensorFlow_In_SageMaker.ipynb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@
119119
"\n",
120120
"**Create a copy of the script (training_script/cifar10_keras.py) and save it as training_script/cifar10_keras_sm.py.**\n",
121121
"\n",
122-
"In cifar10_keras_sm.py, update the train,validation,eval arguments to get the data by default from the relevant environment variable: SM_CHANNEL_TRAIN, SM_CHANNEL_VALIDATION, SM_CHANNEL_EVAL\n",
123-
"Add the default configuration to the arguments in **cifar10_keras_sm.py**:\n",
122+
"In cifar10_keras_sm.py, scroll down to the **if __name__ == '__main__':** section. \n",
123+
"Update the train,validation,eval arguments to get the data by default from the relevant environment variable: SM_CHANNEL_TRAIN, SM_CHANNEL_VALIDATION, SM_CHANNEL_EVAL\n",
124+
"Add the default configuration to the arguments in **cifar10_keras_sm.py**. \n",
125+
"The lines should look as following:\n",
124126
"```python\n",
125127
"parser.add_argument(\n",
126128
" '--train',\n",
@@ -248,7 +250,7 @@
248250
" entry_point='cifar10_keras_sm.py',\n",
249251
" source_dir='training_script',\n",
250252
" role=role,\n",
251-
" framework_version='1.15.0',\n",
253+
" framework_version='1.12.0',\n",
252254
" py_version='py3',\n",
253255
" hyperparameters={'epochs' : 1},\n",
254256
" train_instance_count=1, train_instance_type='local')"
@@ -416,8 +418,17 @@
416418
"nbconvert_exporter": "python",
417419
"pygments_lexer": "ipython3",
418420
"version": "3.6.5"
421+
},
422+
"pycharm": {
423+
"stem_cell": {
424+
"cell_type": "raw",
425+
"source": [],
426+
"metadata": {
427+
"collapsed": false
428+
}
429+
}
419430
}
420431
},
421432
"nbformat": 4,
422433
"nbformat_minor": 4
423-
}
434+
}

training_script/cifar10_keras.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ def _input(epochs, batch_size, channel, channel_name):
150150
def _train_preprocess_fn(image):
151151
"""Preprocess a single training image of layout [height, width, depth]."""
152152
# Resize the image to add four extra pixels on each side.
153-
image = tf.image.resize_with_crop_or_pad(image, HEIGHT + 8, WIDTH + 8)
153+
image = tf.image.resize_image_with_crop_or_pad(image, HEIGHT + 8, WIDTH + 8)
154154

155155
# Randomly crop a [HEIGHT, WIDTH] section of the image.
156-
image = tf.image.random_crop(image, [HEIGHT, WIDTH, DEPTH])
156+
image = tf.random_crop(image, [HEIGHT, WIDTH, DEPTH])
157157

158158
# Randomly flip the image horizontally.
159159
image = tf.image.random_flip_left_right(image)
@@ -164,12 +164,12 @@ def _train_preprocess_fn(image):
164164
def _dataset_parser(value):
165165
"""Parse a CIFAR-10 record from value."""
166166
featdef = {
167-
'image': tf.io.FixedLenFeature([], tf.string),
168-
'label': tf.io.FixedLenFeature([], tf.int64),
167+
'image': tf.FixedLenFeature([], tf.string),
168+
'label': tf.FixedLenFeature([], tf.int64),
169169
}
170170

171-
example = tf.io.parse_single_example(value, featdef)
172-
image = tf.io.decode_raw(example['image'], tf.uint8)
171+
example = tf.parse_single_example(value, featdef)
172+
image = tf.decode_raw(example['image'], tf.uint8)
173173
image.set_shape([DEPTH * HEIGHT * WIDTH])
174174

175175
# Reshape from [depth * height * width] to [depth, height, width].

0 commit comments

Comments
 (0)