tf.math.acos
Stay organized with collections
Save and categorize content based on your preferences.
Computes acos of x element-wise.
tf.math.acos(
x, name=None
)
Used in the notebooks
Provided an input tensor, the tf.math.acos
operation
returns the inverse cosine of each element of the tensor.
If y = tf.math.cos(x)
then, x = tf.math.acos(y)
.
Input range is [-1, 1]
and the output has a range of [0, pi]
.
For example:
x = tf.constant([1.0, -0.5, 3.4, 0.2, 0.0, -2], dtype = tf.float32)
tf.math.acos(x)
<tf.Tensor: shape=(6,), dtype=float32,
numpy= array([0. , 2.0943952, nan, 1.3694383, 1.5707964, nan],
dtype=float32)>
Args |
x
|
A Tensor . Must be one of the following types: bfloat16 , half ,
float32 , float64 , complex64 , complex128 .
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor . Has the same type as x.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.math.acos\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/math_ops.py#L5562-L5590) |\n\nComputes acos of x element-wise.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.acos`](https://www.tensorflow.org/api_docs/python/tf/math/acos)\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.acos`](https://www.tensorflow.org/api_docs/python/tf/math/acos)\n\n\u003cbr /\u003e\n\n tf.math.acos(\n x, name=None\n )\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - [Universal Sentence Encoder](https://www.tensorflow.org/hub/tutorials/semantic_similarity_with_tf_hub_universal_encoder) - [Universal Sentence Encoder-Lite demo](https://www.tensorflow.org/hub/tutorials/semantic_similarity_with_tf_hub_universal_encoder_lite) |\n\nProvided an input tensor, the [`tf.math.acos`](../../tf/math/acos) operation\nreturns the inverse cosine of each element of the tensor.\nIf `y = tf.math.cos(x)` then, `x = tf.math.acos(y)`.\n\nInput range is `[-1, 1]` and the output has a range of `[0, pi]`.\n\n#### For example:\n\n x = tf.constant([1.0, -0.5, 3.4, 0.2, 0.0, -2], dtype = tf.float32)\n tf.math.acos(x)\n \u003ctf.Tensor: shape=(6,), dtype=float32,\n numpy= array([0. , 2.0943952, nan, 1.3694383, 1.5707964, nan],\n dtype=float32)\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|----------------------------------------------------------------------------------------------------------------------|\n| `x` | A `Tensor`. Must be one of the following types: `bfloat16`, `half`, `float32`, `float64`, `complex64`, `complex128`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Has the same type as x. ||\n\n\u003cbr /\u003e"]]