From 59d1ad2e5a7b66fb26827a255b1b6474b3b29d0f Mon Sep 17 00:00:00 2001 From: saishruthi Date: Tue, 25 Jun 2019 16:29:38 -0700 Subject: [PATCH 1/4] Doc update for math functions --- tensorflow/core/api_def/base_api/api_def_Greater.pbtxt | 10 ++++++++++ .../core/api_def/base_api/api_def_GreaterEqual.pbtxt | 10 ++++++++++ .../core/api_def/base_api/api_def_IsFinite.pbtxt | 5 +++++ tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt | 5 +++++ tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt | 5 +++++ tensorflow/core/api_def/base_api/api_def_Less.pbtxt | 10 ++++++++++ .../core/api_def/base_api/api_def_LessEqual.pbtxt | 10 ++++++++++ tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt | 9 +++++++++ tensorflow/core/api_def/base_api/api_def_Log.pbtxt | 5 +++++ tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt | 5 +++++ 10 files changed, 74 insertions(+) diff --git a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt index 4a4e2f2eddc..a169fe055f2 100644 --- a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt @@ -4,5 +4,15 @@ op { description: < [False, True, True] + +x = tf.constant([5, 4, 6]) +y = tf.constant([5]) +tf.math.greater(x,y) ==> [False, False, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt b/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt index dc947f04886..7326613ade7 100644 --- a/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt @@ -4,5 +4,15 @@ op { description: < [True, True, True, False] + +x = tf.constant([5, 4, 6, 7]) +y = tf.constant([5]) +tf.math.greater_equal(x, y) ==> [True, False, True, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_IsFinite.pbtxt b/tensorflow/core/api_def/base_api/api_def_IsFinite.pbtxt index bccc0e32c15..0e89b203ff4 100644 --- a/tensorflow/core/api_def/base_api/api_def_IsFinite.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_IsFinite.pbtxt @@ -5,5 +5,10 @@ op { @compatibility(numpy) Equivalent to np.isfinite @end_compatibility + +```python +x = tf.constant([5.0, 4.8, 6.8, np.inf]) +tf.math.is_finite(x) ==> [True, True, True, False] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt b/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt index 5c390f32d34..80d0e9c7767 100644 --- a/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt @@ -5,5 +5,10 @@ op { @compatibility(numpy) Equivalent to np.isinf @end_compatibility + +```python +x = tf.constant([5.0, np.inf, 6.8, np.inf]) +tf.math.is_inf(x) ==> [False, True, False, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt b/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt index 1487fad9272..5b68e581d09 100644 --- a/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt @@ -5,5 +5,10 @@ op { @compatibility(numpy) Equivalent to np.isnan @end_compatibility + +```python +x = tf.constant([5.0, np.nan, 6.8, np.nan]) +tf.math.is_nan(x) ==> [False, True, False, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Less.pbtxt b/tensorflow/core/api_def/base_api/api_def_Less.pbtxt index 104d583f42a..48ea89a9a49 100644 --- a/tensorflow/core/api_def/base_api/api_def_Less.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Less.pbtxt @@ -4,5 +4,15 @@ op { description: < [False, True, False] + +x = tf.constant([5, 4, 6]) +y = tf.constant([5, 6, 7]) +tf.math.less(x, y) ==> [False, True, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_LessEqual.pbtxt b/tensorflow/core/api_def/base_api/api_def_LessEqual.pbtxt index 637fe2f47ef..a5fcc99073d 100644 --- a/tensorflow/core/api_def/base_api/api_def_LessEqual.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_LessEqual.pbtxt @@ -4,5 +4,15 @@ op { description: < [True, True, False] + +x = tf.constant([5, 4, 6]) +y = tf.constant([5, 6, 6]) +tf.math.less_equal(x, y) ==> [True, True, True] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt b/tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt index fa93f30f387..96c9d07fe05 100644 --- a/tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt @@ -1,4 +1,13 @@ op { graph_op_name: "Lgamma" summary: "Computes the log of the absolute value of `Gamma(x)` element-wise." + description: < [inf, 0.5723649, 0. , 3.1780539] + ``` +END } diff --git a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt index 056f1bc2e27..f0b158d7d44 100644 --- a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt @@ -3,5 +3,10 @@ op { summary: "Computes natural logarithm of x element-wise." description: < [-inf, -0.6931472, 0. , 1.609438] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt b/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt index cc9eb2682e7..1786e51214c 100644 --- a/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt @@ -3,5 +3,10 @@ op { summary: "Computes natural logarithm of (1 + x) element-wise." description: < [0. , 0.4054651, 0.6931472, 1.7917595] +``` END } From 1ff5b3beccf210911382d995e7a8b3c946bfd832 Mon Sep 17 00:00:00 2001 From: saishruthi Date: Wed, 4 Sep 2019 15:27:40 -0700 Subject: [PATCH 2/4] addressing comments --- tensorflow/core/api_def/base_api/api_def_Greater.pbtxt | 5 +++-- .../core/api_def/base_api/api_def_GreaterEqual.pbtxt | 1 + .../core/api_def/base_api/api_def_IsFinite.pbtxt | 5 +++-- tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt | 1 + tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt | 5 +++-- tensorflow/core/api_def/base_api/api_def_Less.pbtxt | 1 + .../core/api_def/base_api/api_def_LessEqual.pbtxt | 1 + tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt | 10 ++++++---- tensorflow/core/api_def/base_api/api_def_Log.pbtxt | 1 + tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt | 1 + 10 files changed, 21 insertions(+), 10 deletions(-) diff --git a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt index a169fe055f2..b69885594c9 100644 --- a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt @@ -4,15 +4,16 @@ op { description: < [False, True, True] +tf.math.greater(x, y) ==> [False, True, True] x = tf.constant([5, 4, 6]) y = tf.constant([5]) -tf.math.greater(x,y) ==> [False, False, True] +tf.math.greater(x, y) ==> [False, False, True] ``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt b/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt index 7326613ade7..b48fe0fde33 100644 --- a/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_GreaterEqual.pbtxt @@ -4,6 +4,7 @@ op { description: < [True, True, True, False] +x = tf.constant([5.0, 4.8, 6.8, np.inf, np.nan]) +tf.math.is_finite(x) ==> [True, True, True, False, False] ``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt b/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt index 80d0e9c7767..5fe2f79f7b0 100644 --- a/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt @@ -5,6 +5,7 @@ op { @compatibility(numpy) Equivalent to np.isinf @end_compatibility + Example: ```python x = tf.constant([5.0, np.inf, 6.8, np.inf]) diff --git a/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt b/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt index 5b68e581d09..159525d9c8d 100644 --- a/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt @@ -5,10 +5,11 @@ op { @compatibility(numpy) Equivalent to np.isnan @end_compatibility + Example: ```python -x = tf.constant([5.0, np.nan, 6.8, np.nan]) -tf.math.is_nan(x) ==> [False, True, False, True] +x = tf.constant([5.0, np.nan, 6.8, np.nan, np.inf]) +tf.math.is_nan(x) ==> [False, True, False, True, False] ``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Less.pbtxt b/tensorflow/core/api_def/base_api/api_def_Less.pbtxt index 48ea89a9a49..decbc599ee4 100644 --- a/tensorflow/core/api_def/base_api/api_def_Less.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Less.pbtxt @@ -4,6 +4,7 @@ op { description: < [inf, 0.5723649, 0. , 3.1780539] + x = tf.constant([0, 0.5, 1, 4.5, -4, -5.6]) + tf.math.lgamma(x) ==> [inf, 0.5723649, 0., 2.4537368, inf, -4.6477685] ``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt index f0b158d7d44..804b2d3a15b 100644 --- a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt @@ -3,6 +3,7 @@ op { summary: "Computes natural logarithm of x element-wise." description: < Date: Wed, 4 Sep 2019 15:30:06 -0700 Subject: [PATCH 3/4] addressing comments --- tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt b/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt index deedd553044..8a2cfb01220 100644 --- a/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt @@ -7,7 +7,7 @@ I.e., \\(y = \log_e (1 + x)\\). ```python x = tf.constant([0, 0.5, 1, 5]) -tf.math.log1p(x) ==> [0. , 0.4054651, 0.6931472, 1.7917595] +tf.math.log1p(x) ==> [0., 0.4054651, 0.6931472, 1.7917595] ``` END } From b88bb2af137de720e94480513494b5ad4e1263dc Mon Sep 17 00:00:00 2001 From: saishruthi Date: Wed, 11 Sep 2019 18:01:42 -0700 Subject: [PATCH 4/4] addressing comments --- tensorflow/core/api_def/base_api/api_def_Greater.pbtxt | 3 ++- .../core/api_def/base_api/api_def_GreaterEqual.pbtxt | 3 ++- .../core/api_def/base_api/api_def_IsFinite.pbtxt | 3 ++- tensorflow/core/api_def/base_api/api_def_IsInf.pbtxt | 3 ++- tensorflow/core/api_def/base_api/api_def_IsNan.pbtxt | 3 ++- tensorflow/core/api_def/base_api/api_def_Less.pbtxt | 3 ++- .../core/api_def/base_api/api_def_LessEqual.pbtxt | 3 ++- tensorflow/core/api_def/base_api/api_def_Lgamma.pbtxt | 10 +++++----- tensorflow/core/api_def/base_api/api_def_Log.pbtxt | 3 ++- tensorflow/core/api_def/base_api/api_def_Log1p.pbtxt | 3 ++- 10 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt index b69885594c9..30212b37004 100644 --- a/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Greater.pbtxt @@ -4,7 +4,8 @@ op { description: < [inf, 0.5723649, 0., 2.4537368, inf, -4.6477685] - ``` +```python +x = tf.constant([0, 0.5, 1, 4.5, -4, -5.6]) +tf.math.lgamma(x) ==> [inf, 0.5723649, 0., 2.4537368, inf, -4.6477685] +``` END } diff --git a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt index 804b2d3a15b..2f86db2e9c7 100644 --- a/tensorflow/core/api_def/base_api/api_def_Log.pbtxt +++ b/tensorflow/core/api_def/base_api/api_def_Log.pbtxt @@ -3,7 +3,8 @@ op { summary: "Computes natural logarithm of x element-wise." description: <