tfp.experimental.math.patch_manual_special_functions
Stay organized with collections
Save and categorize content based on your preferences.
Patches in the manually implemented special functions.
@contextlib.contextmanager
tfp.experimental.math.patch_manual_special_functions()
Normally you'd just use functions coming from the array library you're using,
but on some platforms (like TPU) the default implementations are
insufficiently precise for certain tasks when running under 32 bits (64 bit
implementations are typically okay).
This patches in manual implementations of those functions which are provide
higher precision at the cost of speed. The list of affected functions is:
exp
log
expm1
log1p
logsumexp
(aka reduce_logsumexp
)
softplus
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.experimental.math.patch_manual_special_functions\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/experimental/math/manual_special_functions.py#L308-L381) |\n\nPatches in the manually implemented special functions. \n\n @contextlib.contextmanager\n tfp.experimental.math.patch_manual_special_functions()\n\nNormally you'd just use functions coming from the array library you're using,\nbut on some platforms (like TPU) the default implementations are\ninsufficiently precise for certain tasks when running under 32 bits (64 bit\nimplementations are typically okay).\n\nThis patches in manual implementations of those functions which are provide\nhigher precision at the cost of speed. The list of affected functions is:\n\n- `exp`\n- `log`\n- `expm1`\n- `log1p`\n- `logsumexp` (aka `reduce_logsumexp`)\n- `softplus`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Yields ------ ||\n|---|---|\n| Nothing. ||\n\n\u003cbr /\u003e"]]