tf.math.log
Stay organized with collections
Save and categorize content based on your preferences.
Computes natural logarithm of x element-wise.
tf.math.log(
x: Annotated[Any, tf.raw_ops.Any
],
name=None
) -> Annotated[Any, tf.raw_ops.Any
]
Used in the notebooks
Used in the guide |
Used in the tutorials |
|
|
I.e., \(y = \log_e x\).
Example:
x = tf.constant([0, 0.5, 1, 5])
tf.math.log(x)
<tf.Tensor: shape=(4,), dtype=float32, numpy=array([ -inf, -0.6931472, 0. , 1.609438 ], dtype=float32)>
See: https://en.wikipedia.org/wiki/Logarithm
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.log\n\nComputes natural logarithm of x element-wise.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.log`](https://www.tensorflow.org/api_docs/python/tf/math/log)\n\n\u003cbr /\u003e\n\n tf.math.log(\n x: Annotated[Any, ../../tf/raw_ops/Any],\n name=None\n ) -\u003e Annotated[Any, ../../tf/raw_ops/Any]\n\n### Used in the notebooks\n\n| Used in the guide | Used in the tutorials |\n|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - [Optimizers with Core APIs](https://www.tensorflow.org/guide/core/optimizers_core) | - [Convolutional Variational Autoencoder](https://www.tensorflow.org/tutorials/generative/cvae) - [Playing CartPole with the Actor-Critic method](https://www.tensorflow.org/tutorials/reinforcement_learning/actor_critic) - [Learnable Distributions Zoo](https://www.tensorflow.org/probability/examples/Learnable_Distributions_Zoo) - [Bayesian Modeling with Joint Distribution](https://www.tensorflow.org/probability/examples/Modeling_with_JointDistribution) - [Audio Data Preparation and Augmentation](https://www.tensorflow.org/io/tutorials/audio) |\n\nI.e., \\\\(y = \\\\log_e x\\\\).\n\n#### Example:\n\n x = tf.constant([0, 0.5, 1, 5])\n tf.math.log(x)\n \u003ctf.Tensor: shape=(4,), dtype=float32, numpy=array([ -inf, -0.6931472, 0. , 1.609438 ], dtype=float32)\u003e\n\nSee: \u003chttps://en.wikipedia.org/wiki/Logarithm\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"]]