|
7 | 7 | import pytensor
|
8 | 8 | from pytensor.tensor.basic import arange, as_tensor_variable, constant
|
9 | 9 | from pytensor.tensor.random.op import RandomVariable
|
10 |
| -from pytensor.tensor.random.type import RandomGeneratorType, RandomStateType |
11 | 10 | from pytensor.tensor.random.utils import (
|
12 | 11 | broadcast_params,
|
13 | 12 | )
|
14 |
| -from pytensor.tensor.random.var import ( |
15 |
| - RandomGeneratorSharedVariable, |
16 |
| - RandomStateSharedVariable, |
17 |
| -) |
18 | 13 |
|
19 | 14 |
|
20 | 15 | try:
|
@@ -605,7 +600,7 @@ def __call__(
|
605 | 600 | @classmethod
|
606 | 601 | def rng_fn_scipy(
|
607 | 602 | cls,
|
608 |
| - rng: np.random.Generator | np.random.RandomState, |
| 603 | + rng: np.random.Generator, |
609 | 604 | loc: np.ndarray | float,
|
610 | 605 | scale: np.ndarray | float,
|
611 | 606 | size: list[int] | int | None,
|
@@ -1842,58 +1837,6 @@ def rng_fn(cls, rng, p, size):
|
1842 | 1837 | categorical = CategoricalRV()
|
1843 | 1838 |
|
1844 | 1839 |
|
1845 |
| -class RandIntRV(RandomVariable): |
1846 |
| - r"""A discrete uniform random variable. |
1847 |
| -
|
1848 |
| - Only available for `RandomStateType`. Use `integers` with `RandomGeneratorType`\s. |
1849 |
| -
|
1850 |
| - """ |
1851 |
| - |
1852 |
| - name = "randint" |
1853 |
| - signature = "(),()->()" |
1854 |
| - dtype = "int64" |
1855 |
| - _print_name = ("randint", "\\operatorname{randint}") |
1856 |
| - |
1857 |
| - def __call__(self, low, high=None, size=None, **kwargs): |
1858 |
| - r"""Draw samples from a discrete uniform distribution. |
1859 |
| -
|
1860 |
| - Signature |
1861 |
| - --------- |
1862 |
| -
|
1863 |
| - `() -> ()` |
1864 |
| -
|
1865 |
| - Parameters |
1866 |
| - ---------- |
1867 |
| - low |
1868 |
| - Lower boundary of the output interval. All values generated will |
1869 |
| - be greater than or equal to `low`, unless `high=None`, in which case |
1870 |
| - all values generated are greater than or equal to `0` and |
1871 |
| - smaller than `low` (exclusive). |
1872 |
| - high |
1873 |
| - Upper boundary of the output interval. All values generated |
1874 |
| - will be smaller than `high` (exclusive). |
1875 |
| - size |
1876 |
| - Sample shape. If the given size is `(m, n, k)`, then `m * n * k` |
1877 |
| - independent, identically distributed samples are |
1878 |
| - returned. Default is `None`, in which case a single |
1879 |
| - sample is returned. |
1880 |
| -
|
1881 |
| - """ |
1882 |
| - if high is None: |
1883 |
| - low, high = 0, low |
1884 |
| - return super().__call__(low, high, size=size, **kwargs) |
1885 |
| - |
1886 |
| - def make_node(self, rng, *args, **kwargs): |
1887 |
| - if not isinstance( |
1888 |
| - getattr(rng, "type", None), RandomStateType | RandomStateSharedVariable |
1889 |
| - ): |
1890 |
| - raise TypeError("`randint` is only available for `RandomStateType`s") |
1891 |
| - return super().make_node(rng, *args, **kwargs) |
1892 |
| - |
1893 |
| - |
1894 |
| -randint = RandIntRV() |
1895 |
| - |
1896 |
| - |
1897 | 1840 | class IntegersRV(RandomVariable):
|
1898 | 1841 | r"""A discrete uniform random variable.
|
1899 | 1842 |
|
@@ -1933,14 +1876,6 @@ def __call__(self, low, high=None, size=None, **kwargs):
|
1933 | 1876 | low, high = 0, low
|
1934 | 1877 | return super().__call__(low, high, size=size, **kwargs)
|
1935 | 1878 |
|
1936 |
| - def make_node(self, rng, *args, **kwargs): |
1937 |
| - if not isinstance( |
1938 |
| - getattr(rng, "type", None), |
1939 |
| - RandomGeneratorType | RandomGeneratorSharedVariable, |
1940 |
| - ): |
1941 |
| - raise TypeError("`integers` is only available for `RandomGeneratorType`s") |
1942 |
| - return super().make_node(rng, *args, **kwargs) |
1943 |
| - |
1944 | 1879 |
|
1945 | 1880 | integers = IntegersRV()
|
1946 | 1881 |
|
@@ -2101,7 +2036,6 @@ def permutation(x, **kwargs):
|
2101 | 2036 | "permutation",
|
2102 | 2037 | "choice",
|
2103 | 2038 | "integers",
|
2104 |
| - "randint", |
2105 | 2039 | "categorical",
|
2106 | 2040 | "multinomial",
|
2107 | 2041 | "betabinom",
|
|
0 commit comments