MCPcopy Create free account
hub / github.com/brightmart/albert_zh / PaddingInputExample

Class PaddingInputExample

classifier_utils.py:76–84  ·  view source on GitHub ↗

Fake example so the num input examples is a multiple of the batch size. When running eval/predict on the TPU, we need to pad the number of examples to be a multiple of the batch size, because the TPU requires a fixed batch size. The alternative is to drop the last batch, which is bad because i

Source from the content-addressed store, hash-verified

74
75
76class PaddingInputExample(object):
77 """Fake example so the num input examples is a multiple of the batch size.
78 When running eval/predict on the TPU, we need to pad the number of examples
79 to be a multiple of the batch size, because the TPU requires a fixed batch
80 size. The alternative is to drop the last batch, which is bad because it means
81 the entire output data won't be generated.
82 We use this class instead of `None` because treating `None` as padding
83 battches could cause silent errors.
84 """
85
86
87class DataProcessor(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected