Skip to content

Conversation

@atheendre130505
Copy link

@atheendre130505 atheendre130505 commented Nov 4, 2025

Description

This PR replaces the deprecated pt.batched_dot function with the preferred pt.sum operation in the KroneckerNormal distribution's logprob calculation, addressing issue #7878.

Problem

The current implementation uses batched_dot, which is deprecated in PyTensor and triggers warnings. Deprecated functions may lead to future breakage and lower performance.

Solution

Refactored the KroneckerNormal logprob code to use pt.sum with explicit axis parameters, achieving the same functionality without relying on deprecated APIs.

Tests

  • All existing tests related to KroneckerNormal pass successfully.
  • No deprecation warnings are shown when running the updated code.
  • Validated numerical equivalence with the previous implementation.

Related Issue

Fixes #7878

Checklist

  • Follows PyMC contributing guidelines
  • All tests pass locally
  • No API-breaking changes

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

- Fixes Issue pymc-devs#7878
- Replace pt.batched_dot(sqrt_quad.T, sqrt_quad.T) with pt.sum(sqrt_quad.T ** 2, axis=-1)
- Computes squared norm per sample using modern PyTensor operations
- Eliminates deprecation warnings and ensures future compatibility
@github-actions github-actions bot added GP Gaussian Process pytensor labels Nov 4, 2025
@atheendre130505
Copy link
Author

pre-commit.ci autofix

@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.48%. Comparing base (a6e6fa8) to head (84f3fd1).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7951      +/-   ##
==========================================
+ Coverage   90.62%   91.48%   +0.86%     
==========================================
  Files         116      116              
  Lines       18947    18947              
==========================================
+ Hits        17170    17333     +163     
+ Misses       1777     1614     -163     
Files with missing lines Coverage Δ
pymc/distributions/multivariate.py 93.91% <100.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 changed the title [BUG] Replace deprecated batched_dot with pt.sum in KroneckerNormal (fixes #7878) Don't use deprecated batched_dot Nov 8, 2025
@ricardoV94 ricardoV94 added maintenance no releasenotes Skipped in automatic release notes generation labels Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GP Gaussian Process maintenance no releasenotes Skipped in automatic release notes generation pytensor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KroneckerNormal using deprecated batched_dot

2 participants