tf_quant_finance.math.qmc.utils.log2

Contents

Last updated: 2023-03-16.

tf_quant_finance.math.qmc.utils.log2#

View source

Returns the point-wise base-2 logarithm a given Tensor.

tf_quant_finance.math.qmc.utils.log2(
    value
)
import tensorflow as tf
import tf_quant_finance as tff

# Example: Computing the base-2 logarithm of a given vector.

tff.math.qmc.utils.log2(tf.constant([1, 2, 4, 8, 16], dtype=tf.float32))
# ==> tf.Tensor([0., 1., 2., 3., 4.], shape=(5,), dtype=float32)

Args:#

  • value: Positive scalar Tensor of real values.

Returns:#

Tensor with the same shape and dtype as value equal to ln(value) / ln(2).