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

Remove unnecessary handling of no longer supported RandomState #1300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Mar 18, 2025

Small cleanup


📚 Documentation preview 📚: https://pytensor--1300.org.readthedocs.build/en/1300/

Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.01%. Comparing base (c822a8e) to head (702889b).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1300      +/-   ##
==========================================
- Coverage   82.03%   82.01%   -0.02%     
==========================================
  Files         188      188              
  Lines       48567    48433     -134     
  Branches     8675     8657      -18     
==========================================
- Hits        39841    39724     -117     
+ Misses       6574     6564      -10     
+ Partials     2152     2145       -7     
Files with missing lines Coverage Δ
pytensor/link/jax/linker.py 95.00% <100.00%> (ø)
pytensor/link/numba/linker.py 100.00% <100.00%> (+15.00%) ⬆️

... and 12 files with indirect coverage changes

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

@Armavica
Copy link
Member

There are others at other places of the code, are those still needed?

❯ rg -w RandomState
tests/unittest_tools.py
30:    Useful for seeding RandomState or Generator objects.
31:    >>> rng = np.random.RandomState(fetch_seed())

pytensor/tensor/random/var.py
14:@shared_constructor.register(np.random.RandomState)
19:    r"""`SharedVariable` constructor for NumPy's `Generator` and/or `RandomState`."""
20:    if isinstance(value, np.random.RandomState):
22:            "`np.RandomState` is no longer supported in PyTensor. Use `np.random.Generator` instead."

pytensor/tensor/random/type.py
9:T = TypeVar("T", np.random.RandomState, np.random.Generator)
27:    r"""A Type wrapper for `numpy.random.Generator` and `numpy.random.RandomState`."""

doc/optimizations.rst
242:        Typically when a graph uses random numbers, the RandomState is stored

pytensor/compile/nanguardmode.py
37:    elif isinstance(arr, np.random.mtrand.RandomState | np.random.Generator):

pytensor/compile/monitormode.py
108:            not isinstance(output[0], np.random.RandomState | np.random.Generator)

doc/extending/extending_pytensor_solution_1.py
121:        rng = np.random.RandomState(43)
131:        rng = np.random.RandomState(43)
153:        rng = np.random.RandomState(43)

pytensor/gradient.py
1804:    rng: np.random.Generator | np.random.RandomState | None = None,

doc/library/d3viz/index.rst
61:    rng = np.random.RandomState(0)

doc/library/d3viz/index.ipynb
98:    "rng = np.random.RandomState(0)\n",

tests/tensor/random/test_basic.py
1422:        integers(10, rng=shared(np.random.RandomState()))

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

Successfully merging this pull request may close these issues.

2 participants