Join the newly launched Discord
community for real-time discussions, peer support, and direct interaction with the Meridian team!
meridian.backend.log
Stay organized with collections
Save and categorize content based on your preferences.
Computes natural logarithm of x element-wise.
meridian
.
backend
.
log
(
x
:
Annotated
[
Any
,
TV_Log_T
],
name
=
None
)
->
Annotated
[
Any
,
TV_Log_T
]
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
A Tensor
. Must be one of the following types: bfloat16
, half
, float32
, float64
, complex64
, complex128
.
A name for the operation (optional).
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.
Last updated 2025-08-15 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["# meridian.backend.log\n\n\u003cbr /\u003e\n\nComputes natural logarithm of x element-wise. \n\n meridian.backend.log(\n x: Annotated[Any, TV_Log_T], name=None\n ) -\u003e Annotated[Any, TV_Log_T]\n\nI.e., \\\\(y = \\\\log_e x\\\\).\n\n#### Example:\n\n \u003e\u003e\u003e x = tf.constant([0, 0.5, 1, 5])\n \u003e\u003e\u003e tf.math.log(x)\n \u003ctf.Tensor: shape=(4,), dtype=float32, numpy=array([ -inf, -0.6931472, 0. , 1.609438 ], dtype=float32)\u003e\n\nSee: https://en.wikipedia.org/wiki/Logarithm\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"]]