Retrieves the Scaffold from `captured_scaffold_fn`.
(captured_scaffold_fn)
| 49 | |
| 50 | |
| 51 | def _get_scaffold(captured_scaffold_fn): |
| 52 | """Retrieves the Scaffold from `captured_scaffold_fn`.""" |
| 53 | scaffold_fn = captured_scaffold_fn.get() |
| 54 | |
| 55 | if not scaffold_fn: |
| 56 | return None |
| 57 | |
| 58 | scaffold = scaffold_fn() |
| 59 | if scaffold is None: |
| 60 | raise ValueError( |
| 61 | 'TPUEstimatorSpec.scaffold_fn returns None, which is not allowed') |
| 62 | |
| 63 | return scaffold |
| 64 | |
| 65 | |
| 66 | class _ModelFnWrapper(object): |