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

Add tf.print an an alias for tf.Print #19234

Merged
merged 1 commit into from
May 17, 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
5 changes: 3 additions & 2 deletions tensorflow/python/ops/logging_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@


# Assert and Print are special symbols in python, so we must
# use an upper-case version of them.
@tf_export("Print")
# have an upper-case version of them. For users with Python 3 or Python 2.7
# with `from __future__ import print_function`, we also allow lowercase.
@tf_export("Print", "print")
def Print(input_, data, message=None, first_n=None, summarize=None,
name=None):
"""Prints a list of tensors.
Expand Down
7 changes: 6 additions & 1 deletion tensorflow/tools/api/generator/create_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
This file is MACHINE GENERATED! Do not edit.
Generated by: tensorflow/tools/api/generator/create_python_api.py script.
\"\"\"

from __future__ import print_function

"""
_GENERATED_FILE_FOOTER = "\n\ndel print_function\n"


class SymbolExposedTwiceError(Exception):
Expand Down Expand Up @@ -146,6 +150,7 @@ def build(self):
_names_with_underscore = [%s]
__all__ = [s for s in dir() if not s.startswith('_')]
__all__.extend([s for s in _names_with_underscore])
__all__.remove('print_function')
''' % underscore_names_str

return module_text_map
Expand Down Expand Up @@ -269,7 +274,7 @@ def create_api_files(output_files, module_filter):
missing_output_files.append(module_file_path)
continue
with open(module_name_to_file_path[module], 'w') as fp:
fp.write(_GENERATED_FILE_HEADER + text)
fp.write(_GENERATED_FILE_HEADER + text + _GENERATED_FILE_FOOTER)

if missing_output_files:
raise ValueError(
Expand Down
4 changes: 4 additions & 0 deletions tensorflow/tools/api/golden/tensorflow.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,10 @@ tf_module {
name: "pow"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "print"
argspec: "args=[\'input_\', \'data\', \'message\', \'first_n\', \'summarize\', \'name\'], varargs=None, keywords=None, defaults=[\'None\', \'None\', \'None\', \'None\'], "
}
member_method {
name: "py_func"
argspec: "args=[\'func\', \'inp\', \'Tout\', \'stateful\', \'name\'], varargs=None, keywords=None, defaults=[\'True\', \'None\'], "
Expand Down