|
9 | 9 | from pytensor.tensor.basic import as_tensor_variable
|
10 | 10 | from pytensor.tensor.math import sqrt
|
11 | 11 | from pytensor.tensor.random.op import RandomVariable
|
12 |
| -from pytensor.tensor.random.type import RandomGeneratorType, RandomStateType |
13 | 12 | from pytensor.tensor.random.utils import (
|
14 | 13 | broadcast_params,
|
15 | 14 | normalize_size_param,
|
16 | 15 | )
|
17 |
| -from pytensor.tensor.random.var import ( |
18 |
| - RandomGeneratorSharedVariable, |
19 |
| - RandomStateSharedVariable, |
20 |
| -) |
21 | 16 |
|
22 | 17 |
|
23 | 18 | try:
|
@@ -645,7 +640,7 @@ def __call__(
|
645 | 640 | @classmethod
|
646 | 641 | def rng_fn_scipy(
|
647 | 642 | cls,
|
648 |
| - rng: np.random.Generator | np.random.RandomState, |
| 643 | + rng: np.random.Generator, |
649 | 644 | loc: np.ndarray | float,
|
650 | 645 | scale: np.ndarray | float,
|
651 | 646 | size: list[int] | int | None,
|
@@ -1880,58 +1875,6 @@ def rng_fn(cls, rng, p, size):
|
1880 | 1875 | categorical = CategoricalRV()
|
1881 | 1876 |
|
1882 | 1877 |
|
1883 |
| -class RandIntRV(RandomVariable): |
1884 |
| - r"""A discrete uniform random variable. |
1885 |
| -
|
1886 |
| - Only available for `RandomStateType`. Use `integers` with `RandomGeneratorType`\s. |
1887 |
| -
|
1888 |
| - """ |
1889 |
| - |
1890 |
| - name = "randint" |
1891 |
| - signature = "(),()->()" |
1892 |
| - dtype = "int64" |
1893 |
| - _print_name = ("randint", "\\operatorname{randint}") |
1894 |
| - |
1895 |
| - def __call__(self, low, high=None, size=None, **kwargs): |
1896 |
| - r"""Draw samples from a discrete uniform distribution. |
1897 |
| -
|
1898 |
| - Signature |
1899 |
| - --------- |
1900 |
| -
|
1901 |
| - `() -> ()` |
1902 |
| -
|
1903 |
| - Parameters |
1904 |
| - ---------- |
1905 |
| - low |
1906 |
| - Lower boundary of the output interval. All values generated will |
1907 |
| - be greater than or equal to `low`, unless `high=None`, in which case |
1908 |
| - all values generated are greater than or equal to `0` and |
1909 |
| - smaller than `low` (exclusive). |
1910 |
| - high |
1911 |
| - Upper boundary of the output interval. All values generated |
1912 |
| - will be smaller than `high` (exclusive). |
1913 |
| - size |
1914 |
| - Sample shape. If the given size is `(m, n, k)`, then `m * n * k` |
1915 |
| - independent, identically distributed samples are |
1916 |
| - returned. Default is `None`, in which case a single |
1917 |
| - sample is returned. |
1918 |
| -
|
1919 |
| - """ |
1920 |
| - if high is None: |
1921 |
| - low, high = 0, low |
1922 |
| - return super().__call__(low, high, size=size, **kwargs) |
1923 |
| - |
1924 |
| - def make_node(self, rng, *args, **kwargs): |
1925 |
| - if not isinstance( |
1926 |
| - getattr(rng, "type", None), RandomStateType | RandomStateSharedVariable |
1927 |
| - ): |
1928 |
| - raise TypeError("`randint` is only available for `RandomStateType`s") |
1929 |
| - return super().make_node(rng, *args, **kwargs) |
1930 |
| - |
1931 |
| - |
1932 |
| -randint = RandIntRV() |
1933 |
| - |
1934 |
| - |
1935 | 1878 | class IntegersRV(RandomVariable):
|
1936 | 1879 | r"""A discrete uniform random variable.
|
1937 | 1880 |
|
@@ -1971,14 +1914,6 @@ def __call__(self, low, high=None, size=None, **kwargs):
|
1971 | 1914 | low, high = 0, low
|
1972 | 1915 | return super().__call__(low, high, size=size, **kwargs)
|
1973 | 1916 |
|
1974 |
| - def make_node(self, rng, *args, **kwargs): |
1975 |
| - if not isinstance( |
1976 |
| - getattr(rng, "type", None), |
1977 |
| - RandomGeneratorType | RandomGeneratorSharedVariable, |
1978 |
| - ): |
1979 |
| - raise TypeError("`integers` is only available for `RandomGeneratorType`s") |
1980 |
| - return super().make_node(rng, *args, **kwargs) |
1981 |
| - |
1982 | 1917 |
|
1983 | 1918 | integers = IntegersRV()
|
1984 | 1919 |
|
@@ -2201,7 +2136,6 @@ def permutation(x, **kwargs):
|
2201 | 2136 | "permutation",
|
2202 | 2137 | "choice",
|
2203 | 2138 | "integers",
|
2204 |
| - "randint", |
2205 | 2139 | "categorical",
|
2206 | 2140 | "multinomial",
|
2207 | 2141 | "betabinom",
|
|
0 commit comments