Setting drop_remainder for Static Batching
Navigate to the data preprocessing file official/vision/image_classification/resnet/imagenet_preprocessing.py based on the training script logic.
Set drop_remainder to True in the data read function input_fn to complete the porting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | def input_fn(is_training, data_dir, batch_size, dtype=tf.float32, datasets_num_private_threads=None, parse_record_fn=parse_record, input_context=None, drop_remainder=False, tf_data_experimental_slack=False, training_dataset_cache=False, filenames=None): ...... Returns: A dataset that can be used for iteration. """ drop_remainder=True if filenames is None: filenames = get_filenames(is_training, data_dir) dataset = tf.data.Dataset.from_tensor_slices(filenames) |
Parent topic: Manual Porting and Training