Skip to content

Commit

Permalink
Merge pull request tensorflow#35005 from geetachavan1/cherrypicks_3SVHU
Browse files Browse the repository at this point in the history
[r2.1:Cherrypick] Expose ndtri and erfinv under tf.math.ndtri and tf.math.erfinv.
  • Loading branch information
goldiegadde authored Dec 10, 2019
2 parents ca587c0 + 01464cf commit 064e153
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 16 deletions.
4 changes: 4 additions & 0 deletions tensorflow/core/api_def/python_api/api_def_Erfinv.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
op {
graph_op_name: "Erfinv"
visibility: HIDDEN
}
4 changes: 4 additions & 0 deletions tensorflow/core/api_def/python_api/api_def_Ndtri.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
op {
graph_op_name: "Ndtri"
visibility: HIDDEN
}
34 changes: 34 additions & 0 deletions tensorflow/python/ops/math_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
tf_export(v1=["arg_max"])(arg_max)
tf_export(v1=["arg_min"])(arg_min)


# This is set by resource_variable_ops.py. It is included in this way since
# there is a circular dependency between math_ops and resource_variable_ops
_resource_variable_type = None
Expand Down Expand Up @@ -4187,3 +4188,36 @@ def reciprocal_no_nan(x, name=None):
x = ops.convert_to_tensor(x, name="x")
one = constant_op.constant(1, dtype=x.dtype.base_dtype, name="one")
return gen_math_ops.div_no_nan(one, x, name=scope)


@tf_export("math.erfinv")
@dispatch.add_dispatch_support
def erfinv(x, name=None):
"""Compute inverse error function.
Given `x`, compute the inverse error function of `x`. This function
is the inverse of `tf.math.erf`.
Args:
x: `Tensor` with type `float` or `double`.
name: A name for the operation (optional).
Returns:
Inverse error function of `x`.
"""
with ops.name_scope(name, "erfinv", [x]):
return gen_math_ops.erfinv(x)


@tf_export("math.ndtri")
@dispatch.add_dispatch_support
def ndtri(x, name=None):
"""Compute quantile of Standard Normal.
Args:
x: `Tensor` with type `float` or `double`.
name: A name for the operation (optional).
Returns:
Inverse error function of `x`.
"""
with ops.name_scope(name, "ndtri", [x]):
return gen_math_ops.ndtri(x)
8 changes: 8 additions & 0 deletions tensorflow/tools/api/golden/v1/tensorflow.math.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ tf_module {
name: "erfc"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "erfinv"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "exp"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down Expand Up @@ -280,6 +284,10 @@ tf_module {
name: "multiply_no_nan"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "ndtri"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "negative"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down
8 changes: 0 additions & 8 deletions tensorflow/tools/api/golden/v1/tensorflow.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,6 @@ tf_module {
name: "erfc"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "erfinv"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "executing_eagerly"
argspec: "args=[], varargs=None, keywords=None, defaults=None"
Expand Down Expand Up @@ -1716,10 +1712,6 @@ tf_module {
name: "multiply"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "ndtri"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "negative"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down
8 changes: 8 additions & 0 deletions tensorflow/tools/api/golden/v2/tensorflow.math.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ tf_module {
name: "erfc"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "erfinv"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "exp"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down Expand Up @@ -280,6 +284,10 @@ tf_module {
name: "multiply_no_nan"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "ndtri"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "negative"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down
8 changes: 0 additions & 8 deletions tensorflow/tools/api/golden/v2/tensorflow.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,6 @@ tf_module {
name: "equal"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "erfinv"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "executing_eagerly"
argspec: "args=[], varargs=None, keywords=None, defaults=None"
Expand Down Expand Up @@ -812,10 +808,6 @@ tf_module {
name: "multiply"
argspec: "args=[\'x\', \'y\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "ndtri"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
}
member_method {
name: "negative"
argspec: "args=[\'x\', \'name\'], varargs=None, keywords=None, defaults=[\'None\'], "
Expand Down

0 comments on commit 064e153

Please sign in to comment.