Skip to content

Numerical instabilities with tf.float32 for cholesky decomposition #307

@Sayam753

Description

@Sayam753

Carrying forward the discussions in #289 , it will be great to investigate cholesky decomposition errors further with tf.float32. Here's a good starting point -

import tensorflow as tf
tf.random.set_seed(42)

def cov(shape, dtype):
  sigma = tf.random.normal((shape, shape), dtype=dtype)
  return tf.linalg.cholesky(tf.matmul(sigma, sigma, transpose_a=True))

cov(10**4, tf.float32)  # decomposition errors
cov(10**4, tf.float64)  # works all good

Should I open this issue in TF side?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions