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

Fix test failures due to old change_flags API #7475

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

maresb
Copy link
Contributor

@maresb maresb commented Aug 23, 2024

Breakage was caused by this:
pymc-devs/pytensor@936554c Fix is to unpack the dict into kwargs.

Description

Related Issue

  • Closes #
  • Related to #

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc--7475.org.readthedocs.build/en/7475/

Breakage was caused by this:
<pymc-devs/pytensor@936554c>
Fix is to unpack the dict into kwargs.
@maresb maresb requested a review from ricardoV94 August 23, 2024 21:28
@ricardoV94
Copy link
Member

ricardoV94 commented Aug 24, 2024

The other failing test may be something that @jessegrabowski knows about

@maresb
Copy link
Contributor Author

maresb commented Aug 24, 2024

Is there an issue or PR tracking this other failing test?

AILED tests/distributions/test_multivariate.py::TestMatchesScipy::test_kroneckernormal[None-3-2] - ValueError: shape mismatch: value array of shape (2,) could not be broadcast to indexing result of shape (3,)
Apply node that caused the error: AdvancedSetSubtensor(Alloc.0, *0-<Vector(float64, shape=(3,))>, [0 1 2], [0 1 2])
Toposort index: 1
Inputs types: [TensorType(float64, shape=(3, 3)), TensorType(float64, shape=(3,)), TensorType(uint8, shape=(3,)), TensorType(uint8, shape=(3,))]
Inputs shapes: [(3, 3), (2,), (3,), (3,)]
Inputs strides: [(24, 8), (8,), (1,), (1,)]
Inputs values: ['not shown', array([2.00033806, 3.69369647]), array([0, 1, 2], dtype=uint8), array([0, 1, 2], dtype=uint8)]
Inputs type_num: [12, 12, 2, 2]
Outputs clients: [[output[0](AdvancedSetSubtensor.0)]]

Backtrace when the node is created (use PyTensor flag traceback__limit=N to make it longer):
  File "/usr/share/miniconda3/envs/pymc-test/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/usr/share/miniconda3/envs/pymc-test/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/share/miniconda3/envs/pymc-test/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/usr/share/miniconda3/envs/pymc-test/lib/python3.12/site-packages/_pytest/python.py", line 159, in pytest_pyfunc_call
    result = testfunction(**testargs)
  File "/home/runner/work/pymc/pymc/tests/distributions/test_multivariate.py", line 460, in test_kroneckernormal
    check_logp(
  File "/home/runner/work/pymc/pymc/pymc/testing.py", line 356, in check_logp
    dist = create_dist_from_paramdomains(pymc_dist, paramdomains, extra_args)
  File "/home/runner/work/pymc/pymc/pymc/testing.py", line 271, in create_dist_from_paramdomains
    return pymc_dist.dist(**param_vars, **extra_args)
  File "/home/runner/work/pymc/pymc/pymc/distributions/multivariate.py", line 2087, in dist
    cov_i = pt.dot(Q, pt.dot(pt.diag(eig), Q.T))

Debug print of the apply node: 
AdvancedSetSubtensor [id A] <Matrix(float64, shape=(?, ?))>
 ├─ Alloc [id B] <Matrix(float64, shape=(3, 3))>
 │  ├─ 0.0 [id C] <Scalar(float64, shape=())>
 │  ├─ 3 [id D] <Scalar(int64, shape=())>
 │  └─ 3 [id D] <Scalar(int64, shape=())>
 ├─ *0-<Vector(float64, shape=(3,))> [id E] <Vector(float64, shape=(3,))>
 ├─ [0 1 2] [id F] <Vector(uint8, shape=(3,))>
 └─ [0 1 2] [id F] <Vector(uint8, shape=(3,))>

Storage map footprint:
 - Alloc.0, Shape: (3, 3), ElemSize: 8 Byte(s), TotalSize: 72 Byte(s)
 - AdvancedSetSubtensor.0, Shape: (3, 3), ElemSize: 8 Byte(s), TotalSize: 72 Byte(s)
 - *0-<Vector(float64, shape=(3,))>, Input, Shape: (2,), ElemSize: 8 Byte(s), TotalSize: 16 Byte(s)
 - 0.0, Shape: (), ElemSize: 8 Byte(s), TotalSize: 8.0 Byte(s)
 - 3, Shape: (), ElemSize: 8 Byte(s), TotalSize: 8.0 Byte(s)
 - [0 1 2], Shape: (3,), ElemSize: 1 Byte(s), TotalSize: 3 Byte(s)
 TotalSize: 107.0 Byte(s) 0.000 GB
 TotalSize inputs: 35.0 Byte(s) 0.000 GB

@ricardoV94
Copy link
Member

ricardoV94 commented Aug 24, 2024

It will be solved by pymc-devs/pytensor#981

@ricardoV94 ricardoV94 merged commit 68a7578 into pymc-devs:main Aug 24, 2024
19 of 21 checks passed
@maresb maresb deleted the fix-change-flags branch August 24, 2024 13:29
@ricardoV94 ricardoV94 added the no releasenotes Skipped in automatic release notes generation label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no releasenotes Skipped in automatic release notes generation pytensor tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants