Enable type annotations for python/ops.

PiperOrigin-RevId: 317234494
Change-Id: I49a24cd1e2127a3c7b0f2eb217cfe023ce5b439f
This commit is contained in:
A. Unique TensorFlower 2020-06-18 20:02:06 -07:00 committed by TensorFlower Gardener
parent 3d868aa1c6
commit 4d54ef3139

View File

@ -54,9 +54,11 @@ except NameError:
# call relies on certain conditionals for its dependencies. Use
# control_flow_ops.Assert.
# Assert and Print are special symbols in Python 2, so we must
# have an upper-case version of them. When support for it is dropped,
# we can allow lowercase.
# Assert and Print are special symbols in python, so we must
# have an upper-case version of them.
#
# For users with Python 3 or Python 2.7
# with `from __future__ import print_function`, we could also allow lowercase.
# See https://github.com/tensorflow/tensorflow/issues/18053
@ -81,6 +83,11 @@ def Print(input_, data, message=None, first_n=None, summarize=None, name=None):
with jupyter notebook (printing to the notebook *server's* output, not into
the notebook).
Additionally, to use tf.print in python 2.7, users must make sure to import
the following:
`from __future__ import print_function`
Args:
input_: A tensor passed through this op.
data: A list of tensors to print out when op is evaluated.
@ -141,6 +148,11 @@ def print_v2(*inputs, **kwargs):
Python objects. Printed tensors will recursively show the first and last
elements of each dimension to summarize.
@compatibility(python2)
In python 2.7, make sure to import the following:
`from __future__ import print_function`
@end_compatibility
Example:
Single-input usage: