Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Scaffold.default_local_init_op as a public static method. #18398

Merged
merged 4 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorflow/python/estimator/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def export_savedmodel(
# pylint: disable=protected-access
local_init_op = (
estimator_spec.scaffold.local_init_op or
monitored_session.Scaffold._default_local_init_op())
monitored_session.Scaffold.default_local_init_op())
# pylint: enable=protected-access

# Perform the export
Expand Down
14 changes: 12 additions & 2 deletions tensorflow/python/training/monitored_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def default_ready_for_local_init_op():
if self._local_init_op is None:
self._local_init_op = Scaffold.get_or_default(
'local_init_op', ops.GraphKeys.LOCAL_INIT_OP,
Scaffold._default_local_init_op)
Scaffold.default_local_init_op)
if self._summary_op is None:
self._summary_op = Scaffold.get_or_default('summary_op',
ops.GraphKeys.SUMMARY_OP,
Expand Down Expand Up @@ -267,7 +267,17 @@ def get_or_default(arg_name, collection_key, default_constructor):
return op

@staticmethod
def _default_local_init_op():
def default_local_init_op():
"""Returns an op that groups the default local init ops.

This op is used during session initialization when a Scaffold is
initialized without specifying the local_init_op arg. It includes
`tf.local_variables_initializer`, `tf.tables_initializer`, and also
initializes local session resources.

Returns:
The default Scaffold local init op.
"""
return control_flow_ops.group(
variables.local_variables_initializer(),
lookup_ops.tables_initializer(),
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/tools/api/golden/tensorflow.train.-scaffold.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ tf_class {
name: "__init__"
argspec: "args=[\'self\', \'init_op\', \'init_feed_dict\', \'init_fn\', \'ready_op\', \'ready_for_local_init_op\', \'local_init_op\', \'summary_op\', \'saver\', \'copy_from_scaffold\'], varargs=None, keywords=None, defaults=[\'None\', \'None\', \'None\', \'None\', \'None\', \'None\', \'None\', \'None\', \'None\'], "
}
member_method {
name: "default_local_init_op"
argspec: "args=[], varargs=None, keywords=None, defaults=None"
}
member_method {
name: "finalize"
argspec: "args=[\'self\'], varargs=None, keywords=None, defaults=None"
Expand Down