W3cubDocs

/TensorFlow Python

tf.contrib.seq2seq.safe_cumprod

tf.contrib.seq2seq.safe_cumprod(
    x,
    *args,
    **kwargs
)

Defined in tensorflow/contrib/seq2seq/python/ops/attention_wrapper.py.

Computes cumprod of x in logspace using cumsum to avoid underflow.

The cumprod function and its gradient can result in numerical instabilities when its argument has very small and/or zero values. As long as the argument is all positive, we can instead compute the cumulative product as exp(cumsum(log(x))). This function can be called identically to tf.cumprod.

Args:

  • x: Tensor to take the cumulative product of.
  • *args: Passed on to cumsum; these are identical to those in cumprod.
  • **kwargs: Passed on to cumsum; these are identical to those in cumprod.

Returns:

Cumulative product of x.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/seq2seq/safe_cumprod