MCPcopy Create free account
hub / github.com/google-research/language / input_fn

Function input_fn

language/orqa/models/text_classifier_model.py:188–202  ·  view source on GitHub ↗

An input function satisfying the tf.estimator API.

(is_train, name, params)

Source from the content-addressed store, hash-verified

186
187
188def input_fn(is_train, name, params):
189 """An input function satisfying the tf.estimator API."""
190 dataset = text_classification_dataset.get_dataset(
191 data_root=params["data_root"],
192 name=name,
193 split="train" if is_train else "dev")
194 if is_train:
195 dataset = dataset.repeat()
196
197 def _extract_labels(d):
198 return d, d.pop("answers")
199
200 dataset = dataset.map(_extract_labels)
201 dataset = dataset.prefetch(10)
202 return dataset
203
204
205def get_predictor(model_dir):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…