tfp.substrates.numpy.math.log1psquare
Stay organized with collections
Save and categorize content based on your preferences.
Numerically stable calculation of log(1 + x**2)
for small or large |x|
.
tfp.substrates.numpy.math.log1psquare(
x, name=None
)
For sufficiently large x
we use the following observation:
log(1 + x**2) = 2 log(|x|) + log(1 + 1 / x**2)
--> 2 log(|x|) as x --> inf
Numerically, log(1 + 1 / x**2)
is 0
when 1 / x**2
is small relative to
machine epsilon.
Args |
x
|
Float Tensor input.
|
name
|
Python string indicating the name of the TensorFlow operation.
Default value: 'log1psquare' .
|
Returns |
log1psq
|
Float Tensor representing log(1. + x**2.) .
|
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 2023-11-21 UTC.
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.substrates.numpy.math.log1psquare\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/substrates/numpy/math/numeric.py#L29-L61) |\n\nNumerically stable calculation of `log(1 + x**2)` for small or large `|x|`.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfp.experimental.substrates.numpy.math.log1psquare`](https://www.tensorflow.org/probability/api_docs/python/tfp/substrates/numpy/math/log1psquare)\n\n\u003cbr /\u003e\n\n tfp.substrates.numpy.math.log1psquare(\n x, name=None\n )\n\nFor sufficiently large `x` we use the following observation: \n\n log(1 + x**2) = 2 log(|x|) + log(1 + 1 / x**2)\n --\u003e 2 log(|x|) as x --\u003e inf\n\nNumerically, `log(1 + 1 / x**2)` is `0` when `1 / x**2` is small relative to\nmachine epsilon.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------|------------------------------------------------------------------------------------------------|\n| `x` | Float `Tensor` input. |\n| `name` | Python string indicating the name of the TensorFlow operation. Default value: `'log1psquare'`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----------|------------------------------------------------|\n| `log1psq` | Float `Tensor` representing `log(1. + x**2.)`. |\n\n\u003cbr /\u003e"]]