(captured_scaffold_fn)
return scaffold
Retrieves the Scaffold from `captured_scaffold_fn`.
Retrieves the Scaffold from `captured_scaffold_fn`.
Retrieves the Scaffold from captured_scaffold_fn .
def _get_scaffold(captured_scaffold_fn):
  """Retrieves the Scaffold from `captured_scaffold_fn`."""
  with _CapturingContext(message='Inside scaffold_fn'):
    scaffold_fn = captured_scaffold_fn.get()
    if scaffold_fn:
      scaffold = scaffold_fn()
      if scaffold is None:
        raise ValueError(
            'TPUEstimatorSpec.scaffold_fn returns None, which is not allowed')
    else:
      scaffold = None

  if scaffold:
    wrapped_finalize = scaffold.finalize

    def _finalize():
      with _CapturingContext('Inside Scaffold.finalize'):
        wrapped_finalize()

    scaffold.finalize = _finalize
  return scaffold
def _get_scaffold ( captured_scaffold_fn ) : with _CapturingContext ( message = 'Inside scaffold_fn' ) : scaffold_fn = captured_scaffold_fn . get ( ) if scaffold_fn : scaffold = scaffold_fn ( ) if scaffold is None : raise ValueError ( 'TPUEstimatorSpec.scaffold_fn returns None, which is not allowed' ) else : scaffold = None if scaffold : wrapped_finalize = scaffold . finalize def _finalize ( ) : with _CapturingContext ( 'Inside Scaffold.finalize' ) : wrapped_finalize ( ) scaffold . finalize = _finalize return scaffold