MCPcopy Create free account
hub / github.com/CLUEbenchmark/CLUE / PaddingInputExample

Class PaddingInputExample

baselines/models/xlnet/run_classifier.py:158–166  ·  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

156
157
158class PaddingInputExample(object):
159 """Fake example so the num input examples is a multiple of the batch size.
160 When running eval/predict on the TPU, we need to pad the number of examples
161 to be a multiple of the batch size, because the TPU requires a fixed batch
162 size. The alternative is to drop the last batch, which is bad because it means
163 the entire output data won't be generated.
164 We use this class instead of `None` because treating `None` as padding
165 battches could cause silent errors.
166 """
167
168
169class InputFeatures(object):

Callers 8

mainFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected