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

probability_below_threshold does assert_scalar for threshold while threshold can also be a TensorType #883

Open
ioananikova opened this issue Oct 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ioananikova
Copy link

Describe the bug
The class description of probability_below_threshold acquisition function says that threshold can be a float or TensorType. However, at initialization with threshold a TensorType, the tf.debugging.assert_scalar fails and errors out.

To reproduce
Steps to reproduce the behaviour:

  1. create a problem with the ProbabilityOfFeasibility acquisition function (or test with the probability_below_threshold class directly)
  2. give as threshold argument a TensorType (this is useful when a modelstack is used and a different threshold is necessary for each constraint the model learns)
  3. init will fail and say, e.g.: "ValueError: Expected scalar shape, saw shape: (1, 2)"
  4. if you try this with a float as threshold, it does not error.

Include a minimal reproducible code example if relevant.

Expected behaviour
A TensorType should be supported. I commented the assertion and then it gave me correct results with the TensorType. So, the assertion should be changed to check for scalars and tensortypes.

System information

  • OS: WSL
  • Python version: 3.11.6
  • Trieste version: 3.3.4 (but I saw that the latest version still has this assertion)
  • TensorFlow version: 2.15.0
  • GPflow version: 2.9.1

Additional context
Add any other context about the problem here.

@ioananikova ioananikova added the bug Something isn't working label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant