-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Description of your problem
When we are passing tuple (tuple is a valid data-structure for total_size) for total_size
as an argument in _get_scaling()
we are getting TypeError
instead of ValueError
even though it should raise a ValueError
and this is all because of the use of old-style formatting.
Example:
When we pass a tuple containing more than one Ellipsis
it should raise a ValueError
but instead of that, it is throwing TypeError
.
Please provide a minimal, self-contained, and reproducible example.
_get_scaling((1, 2, 5, Ellipsis, Ellipsis), (2, 3), 2)
Please provide the full traceback.
pymc.distributions.logprob._get_scaling()
Input In [1], in _get_scaling(total_size, shape, ndim)
60 end = total_size[sep + 1 :]
61 if Ellipsis in end:
62 raise ValueError(
---> 63 "Double Ellipsis in `total_size` is restricted, got %r" % total_size
64 )
65 else:
66 begin = total_size
TypeError: not all arguments converted during string formatting
Please provide any additional information below.
The above-mentioned issue can be solved by replacing
"Double Ellipsis in `total_size` is restricted, got %r" % total_size
in _get_scaling() by
"Double Ellipsis in `total_size` is restricted, got {}".format(total_size)
Since in present version of code it is trying to unpack the tuple elements which leads to error.
Versions and main components
- PyMC/PyMC3 Version:
4.0.0b2
- Aesara/Theano Version:
2.3.8
- Python Version:
3.8.12
- Operating system:
Windows 10 Pro, Version: 21H1, OS Build: 19043.1566
- How did you install PyMC/PyMC3:
conda
Related To: #5544