Constructs the DocumentEmbedder.
(self, hub_module_spec, featurizer, use_tpu, run_config=None)
| 295 | """ |
| 296 | |
| 297 | def __init__(self, hub_module_spec, featurizer, use_tpu, run_config=None): |
| 298 | """Constructs the DocumentEmbedder.""" |
| 299 | if run_config is None: |
| 300 | if use_tpu: |
| 301 | raise ValueError('Must supply a RunConfig if use_tpu.') |
| 302 | else: |
| 303 | run_config = tf_estimator.tpu.RunConfig() # Just supply a default. |
| 304 | |
| 305 | self._hub_module_spec = hub_module_spec |
| 306 | self._featurizer = featurizer |
| 307 | self._use_tpu = use_tpu |
| 308 | self._run_config = run_config |
| 309 | self._log_interval = 10 # When embedding, log every 10 seconds. |
| 310 | |
| 311 | def embed(self, get_documents_dataset, total_docs, batch_size): |
| 312 | """Embeds a Dataset of documents using Estimator. |
nothing calls this directly
no outgoing calls
no test coverage detected