Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fully_correlated_conditional_repeat fvar broadcast_to issue #1651

Closed
johnamcleod opened this issue Mar 25, 2021 · 0 comments · Fixed by #1652
Closed

fully_correlated_conditional_repeat fvar broadcast_to issue #1651

johnamcleod opened this issue Mar 25, 2021 · 0 comments · Fixed by #1652
Labels

Comments

@johnamcleod
Copy link
Contributor

Bug

Some parameter combinations for fully_correlated_conditional_repeat throw errors:
q_sqrt = None
full_cov and full_output_cov not both False.
throw an InvalidArgumentError.

To reproduce

Minimal, reproducible example

This is a slightly modified version of the unit test for fully_correlated_conditional_repeat.

import gpflow
import tensorflow as tf

Kmm = tf.ones((6, 6)) + gpflow.default_jitter() * tf.eye(6)
Kmn = tf.ones((6, 20, 5))
Knn = tf.ones((20, 5, 5))
f = tf.ones((6, 7))
q_sqrt = None
white = True

m, v = gpflow.conditionals.util.fully_correlated_conditional_repeat(
    Kmn, Kmm, Knn, f, full_cov=False, full_output_cov=True, q_sqrt=q_sqrt, white=white,
)

Stack trace, or error message

/usr/local/lib/python3.7/dist-packages/gpflow/conditionals/util.py in fully_correlated_conditional_repeat(Kmn, Kmm, Knn, f, full_cov, full_output_cov, q_sqrt, white)
    460             fvar = fvar[None, ...] + addvar  # [R, N, P]
    461     else:
--> 462         fvar = tf.broadcast_to(fvar[None], tf.shape(fmean))
    463 
    464     shape_constraints.extend(

/usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/gen_array_ops.py in broadcast_to(input, shape, name)
    825       return _result
    826     except _core._NotOkStatusException as e:
--> 827       _ops.raise_from_not_ok_status(e, name)
    828     except _core._FallbackException:
    829       pass

/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py in raise_from_not_ok_status(e, name)
   6860   message = e.message + (" name: " + name if name is not None else "")
   6861   # pylint: disable=protected-access
-> 6862   six.raise_from(core._status_to_exception(e.code, message), None)
   6863   # pylint: enable=protected-access
   6864 

/usr/local/lib/python3.7/dist-packages/six.py in raise_from(value, from_value)

InvalidArgumentError: Rank of input (4) must be no greater than rank of output shape (3). [Op:BroadcastTo]

Expected behavior

Return the mean and variance.

System information

  • GPflow version: 2.1.4
  • GPflow installed from: git commit 405eb97
  • TensorFlow version: 2.3.0
  • Python version: 3.7.5
  • Operating system: Ubuntu 18.04.5 LTS

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant