tf_quant_finance.math.qmc.utils.exp2

Last updated: 2023-03-16.

tf_quant_finance.math.qmc.utils.exp2#

View source

Returns the point-wise base-2 exponentiation of a given Tensor.

tf_quant_finance.math.qmc.utils.exp2(
    value
)

Args:#

  • value: Positive scalar Tensor of integers.

Examples#

import tensorflow as tf
import tf_quant_finance as tff

# Example: Computing the base-2 exponentiation of a range.

tff.math.qmc.utils.exp2(tf.range(0, 5))
# ==> tf.Tensor([1, 2, 4, 8, 16], shape=(5,), dtype=int32)

Returns:#

Tensor with the same shape and dtype as value equal to 1 << value.