-
Notifications
You must be signed in to change notification settings - Fork 135
Small improvements to docs API #817
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Read the Docs Pull Request Preview | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
documentation-links: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: readthedocs/actions/preview@v1 | ||
with: | ||
project-slug: "pytensor" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
|
||
.. _libdoc_graph_op: | ||
|
||
============================================================== | ||
:mod:`graph` -- Objects and functions for computational graphs | ||
============================================================== | ||
=========================================== | ||
:mod:`op` -- Objects that define operations | ||
=========================================== | ||
|
||
.. automodule:: pytensor.graph.op | ||
:platform: Unix, Windows | ||
:synopsis: Interface for types of symbolic variables | ||
:members: | ||
.. moduleauthor:: LISA | ||
:members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. _libdoc_graph_replace: | ||
|
||
================================================== | ||
:mod:`replace` -- High level graph transformations | ||
================================================== | ||
|
||
.. automodule:: pytensor.graph.replace | ||
:members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. automodule:: pytensor.tensor.functional | ||
:members: vectorize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. _libdoc_tensor_random_distributions: | ||
|
||
Distributions | ||
============= | ||
|
||
.. automodule:: pytensor.tensor.random.basic | ||
:members: | ||
:special-members: __call__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,89 @@ | ||
.. _libdoc_tensor_random: | ||
|
||
.. _libdoc_tensor_random_basic: | ||
|
||
============================================= | ||
:mod:`random` -- Low-level random numbers | ||
:mod:`random` -- Random number functionality | ||
============================================= | ||
|
||
Low-level random numbers | ||
------------------------ | ||
.. module:: pytensor.tensor.random | ||
:synopsis: symbolic random variables | ||
|
||
|
||
The :mod:`pytensor.tensor.random` module provides random-number drawing functionality | ||
that closely resembles the :mod:`numpy.random` module. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
basic | ||
utils | ||
High-level API | ||
============== | ||
|
||
PyTensor assigns NumPy RNG states (i.e. `Generator` objects) to | ||
each `RandomVariable`. The combination of an RNG state, a specific | ||
`RandomVariable` type (e.g. `NormalRV`), and a set of distribution parameters | ||
uniquely defines the `RandomVariable` instances in a graph. | ||
|
||
This means that a "stream" of distinct RNG states is required in order to | ||
produce distinct random variables of the same kind. `RandomStream` provides a | ||
means of generating distinct random variables in a fully reproducible way. | ||
|
||
`RandomStream` is also designed to produce simpler graphs and work with more | ||
sophisticated `Op`\s like `Scan`, which makes it a user-friendly random variable | ||
interface in PyTensor. | ||
|
||
For an example of how to use random numbers, see :ref:`Using Random Numbers <using_random_numbers>`. | ||
|
||
|
||
.. class:: RandomStream() | ||
|
||
This is a symbolic stand-in for `numpy.random.Generator`. | ||
|
||
.. method:: updates() | ||
|
||
:returns: a list of all the (state, new_state) update pairs for the | ||
random variables created by this object | ||
|
||
This can be a convenient shortcut to enumerating all the random | ||
variables in a large graph in the ``update`` argument to | ||
`pytensor.function`. | ||
|
||
.. method:: seed(meta_seed) | ||
|
||
`meta_seed` will be used to seed a temporary random number generator, | ||
that will in turn generate seeds for all random variables | ||
created by this object (via `gen`). | ||
|
||
:returns: None | ||
|
||
.. method:: gen(op, *args, **kwargs) | ||
|
||
Return the random variable from ``op(*args, **kwargs)``. | ||
|
||
This function also adds the returned variable to an internal list so | ||
that it can be seeded later by a call to `seed`. | ||
|
||
.. method:: uniform, normal, binomial, multinomial, random_integers, ... | ||
|
||
See :ref: Available distributions `<_libdoc_tensor_random_distributions>`. | ||
|
||
|
||
.. testcode:: constructors | ||
|
||
from pytensor.tensor.random.utils import RandomStream | ||
|
||
rng = RandomStream() | ||
sample = rng.normal(0, 1, size=(2, 2)) | ||
|
||
fn = pytensor.function([], sample) | ||
print(fn(), fn()) # different numbers due to default updates | ||
|
||
|
||
Low-level objects | ||
================= | ||
|
||
.. automodule:: pytensor.tensor.random.op | ||
:members: RandomVariable, default_rng | ||
|
||
..automodule:: pytensor.tensor.random.type | ||
:members: RandomType, RandomGeneratorType, random_generator_type | ||
|
||
.. automodule:: pytensor.tensor.random.basic | ||
:members: | ||
.. automodule:: pytensor.tensor.random.var | ||
:members: RandomGeneratorSharedVariable |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.