def parse_record_keras(raw_record, is_training, dtype): """Adjust the shape of label.""" image, label = imagenet_main.parse_record(raw_record, is_training, dtype) # Subtract one so that labels are in [0, 1000), and cast to float32 for # Keras model. label = tf.cast(tf.cast(tf.reshape(label, shape=[1]), dtype=tf.int32) - 1, dtype=tf.float32) return image, label