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

Class PaddingInputExample

run_classifier.py:148–156  ·  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

146
147
148class PaddingInputExample(object):
149 """Fake example so the num input examples is a multiple of the batch size.
150 When running eval/predict on the TPU, we need to pad the number of examples
151 to be a multiple of the batch size, because the TPU requires a fixed batch
152 size. The alternative is to drop the last batch, which is bad because it means
153 the entire output data won't be generated.
154 We use this class instead of `None` because treating `None` as padding
155 battches could cause silent errors.
156 """
157
158
159class InputFeatures(object):

Callers 2

mainFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected