Below is input_fn in run_classifier.py.
Is batch_size same as train_batch_size ? I guess no, because params are not passed to None to the estimator.
Should batch_size be same as train_batch_size?
def input_fn(params):
"""The actual input function."""
batch_size = params["batch_size"]
# For training, we want a lot of parallel reading and shuffling.
# For eval, we want no shuffling and parallel reading doesn't matter.
d = tf.data.TFRecordDataset(input_file)
if is_training:
d = d.repeat()
d = d.shuffle(buffer_size=100)
d = d.apply(
tf.contrib.data.map_and_batch(
lambda record: _decode_record(record, name_to_features),
batch_size=batch_size,
drop_remainder=drop_remainder))
return d
I think not.
Not.
"batch_size" is not sames as "train_batch_size".
For training, we make a parallel reading and shuffling.
For eval, we don't.
For both, apply map_and_batch func.
I think it's the logic
"input_fn and model_fn will receive train_batch_size or eval_batch_size unmodified as params['batch_size']."
Details in https://www.tensorflow.org/api_docs/python/tf/contrib/tpu/TPUEstimator.
Most helpful comment
"input_fn and model_fn will receive train_batch_size or eval_batch_size unmodified as params['batch_size']."
Details in https://www.tensorflow.org/api_docs/python/tf/contrib/tpu/TPUEstimator.