pytensor 2.25.3__tar.gz → 2.25.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytensor-2.25.3/pytensor.egg-info → pytensor-2.25.5}/PKG-INFO +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/creating_a_c_op.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/creating_a_numba_jax_op.rst +17 -17
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/type.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/io.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/config.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/basic.rst +34 -34
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/conv.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/optimizations.rst +3 -3
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/adding.rst +7 -7
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/prng.rst +38 -38
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/symbolic_graphs.rst +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/pyproject.toml +3 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/_version.py +3 -3
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/__init__.py +1 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/builders.py +12 -7
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/mode.py +1 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/profiling.py +6 -6
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/configdefaults.py +2 -2
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/configparser.py +1 -5
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/gradient.py +16 -15
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/basic.py +19 -13
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/interface.py +3 -3
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/params_type.py +52 -31
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/type.py +29 -16
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/elemwise.py +3 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/__init__.py +2 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/basic.py +59 -5
- pytensor-2.25.5/pytensor/link/pytorch/dispatch/subtensor.py +124 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/printing.py +3 -2
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/basic.py +3 -3
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/basic.py +18 -10
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/basic.py +16 -15
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/einsum.py +7 -2
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/elemwise.py +15 -15
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/extra_ops.py +5 -5
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/functional.py +4 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/io.py +2 -2
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/math.py +7 -7
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/linalg.py +93 -3
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/utils.py +3 -2
- {pytensor-2.25.3 → pytensor-2.25.5/pytensor.egg-info}/PKG-INFO +1 -1
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor.egg-info/SOURCES.txt +1 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_config.py +0 -9
- {pytensor-2.25.3 → pytensor-2.25.5}/LICENSE.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/MANIFEST.in +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/README.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/.templates/PLACEHOLDER +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/.templates/layout.html +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/LICENSE.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/README.md +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/acknowledgement.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/bcast.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/bcast.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/conf.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/core_development_guide.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/css.inc +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/dev_start_guide.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/environment.yml +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/apply.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/apply.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/apply2.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/creating_an_op.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/ctype.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/extending_faq.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/extending_pytensor_solution_1.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/graph_rewriting.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/graphstructures.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/inplace.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/op.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/other_ops.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/pics/symbolic_graph_opt.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/pics/symbolic_graph_unopt.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/pipeline.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/scan.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/tips.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/unittest.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/extending/using_params.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/faq.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/generate_dtype_tensor_table.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/glossary.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/Elman_srnn.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/PyTensor_RGB.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/blocksparse.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/lstm.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/lstm_memorycell.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/talk2010.gif +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/images/talk2010.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/install.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/internal/how_to_release.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/internal/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/internal/metadocumentation.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/introduction.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/debugmode.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/function.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/mode.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/nanguardmode.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/opfromgraph.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/ops.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/profilemode.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/compile/shared.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/css/d3-context-menu.css +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/css/d3viz.css +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/js/d3-context-menu.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/js/d3.v3.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/js/d3viz.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/js/dagre-d3.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/d3viz/js/graphlib-dot.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/mlp.html +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/mlp.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/mlp2.html +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/mlp2.pdf +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/mlp2.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/ofg.html +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/examples/ofg2.html +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index.ipynb +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index_files/index_10_0.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index_files/index_11_0.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index_files/index_24_0.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/d3viz/index_files/index_25_0.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/gradient.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/features.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/fgraph.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/graph.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/op.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/type.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/graph/utils.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/misc/pkl_utils.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/printing.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/sandbox/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/sandbox/linalg.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/scalar/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/scan.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/sparse/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/sparse/sandbox.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/basic_opt.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/bcast.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/bcast.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/elemwise.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/extra_ops.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/fft.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/io.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/math_opt.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/nlinalg.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/plot_fft.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/random/basic.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/random/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/random/utils.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/slinalg.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/tensor/utils.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/library/typed_list.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/links.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/pylintrc +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/troubleshooting.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/adding_solution_1.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/aliasing.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/apply.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/apply.svg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/bcast.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/broadcasting.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/conditions.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/debug_faq.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/dlogistic.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/examples.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/faq_tutorial.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/gradients.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/index.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/loading_and_saving.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/logistic.gp +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/logistic.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/loop.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/loop_solution_1.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/modes.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/modes_solution_1.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/multi_cores.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/nan_tutorial.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/pics/d3viz.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/pics/logreg_pydotprint_predict.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/pics/logreg_pydotprint_prediction.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/pics/logreg_pydotprint_train.png +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/printing_drawing.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/profiling.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/profiling_example.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/profiling_example_out.prof +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/shape_info.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/tutorial/sparse.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/doc/user_guide.rst +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/bin/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/bin/pytensor_cache.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/breakpoint.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/compiledir.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/compilelock.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/debugmode.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/function/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/function/pfunc.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/function/types.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/io.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/monitormode.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/nanguardmode.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/ops.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/compile/sharedvalue.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/css/d3-context-menu.css +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/css/d3viz.css +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/d3viz.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/formatting.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/js/d3-context-menu.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/js/d3.v3.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/js/d3viz.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/js/dagre-d3.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/d3viz/js/graphlib-dot.min.js +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/destroyhandler.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/features.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/fg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/null_type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/replace.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/db.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/kanren.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/unify.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/rewriting/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/graph/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/ifelse.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/c_code/lazylinker_c.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/c_code/pytensor_mod_helper.h +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/cmodule.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/cutils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/cvm.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/exceptions.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/lazylinker_c.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/c/op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/blas.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/blockwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/einsum.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/elemwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/extra_ops.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/math.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/nlinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/pad.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/random.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/scalar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/scan.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/shape.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/slinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/sort.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/sparse.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/subtensor.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/dispatch/tensor_basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/jax/linker.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/cython_support.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/extra_ops.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/nlinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/random.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/scalar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/scan.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/slinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/sparse.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/subtensor.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/tensor_basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/dispatch/vectorize_codegen.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/numba/linker.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/blas.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/elemwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/extra_ops.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/math.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/nlinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/scalar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/shape.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/dispatch/sort.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/pytorch/linker.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/link/vm.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/check_blas.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/check_blas_many.sh +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/check_duplicate_key.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/elemwise_openmp_speedup.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/elemwise_time_test.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/frozendict.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/may_share_memory.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/ordered_set.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/pkl_utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/misc/safe_asarray.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/py.typed +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/raise_op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/c_code/Faddeeva.cc +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/c_code/Faddeeva.hh +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/c_code/gamma.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/c_code/incbet.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/loop.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/math.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scalar/sharedvar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/checkpoints.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/rewriting.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/scan_perform.pyx +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/scan_perform_ext.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/scan/views.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/rewriting.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/sandbox/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/sandbox/sp.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/sandbox/sp2.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/sharedvar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/sparse/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/blas.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/blas_c.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/blas_headers.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/blas_scipy.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/blockwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/c_code/alt_blas_common.h +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/c_code/alt_blas_template.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/c_code/dimshuffle.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/conv/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/conv/abstract_conv.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/elemwise_cgen.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/exceptions.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/fft.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/fourier.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/inplace.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/linalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/nlinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/pad.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/rewriting/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/rewriting/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/rewriting/jax.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/rewriting/numba.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/random/var.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/blas.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/blas_c.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/blas_scipy.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/blockwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/einsum.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/elemwise.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/extra_ops.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/jax.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/math.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/ofg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/shape.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/special.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/subtensor.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/rewriting/uncanonicalize.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/shape.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/sharedvar.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/slinalg.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/sort.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/special.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/subtensor.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/type_other.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/var.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/variable.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/tensor/xlogx.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/typed_list/__init__.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/typed_list/basic.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/typed_list/rewriting.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/typed_list/type.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/updates.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor/utils.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor.egg-info/dependency_links.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor.egg-info/entry_points.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor.egg-info/requires.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/pytensor.egg-info/top_level.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/scripts/mypy-failing.txt +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/setup.cfg +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/setup.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/link/c/c_code/test_cenum.h +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/link/c/c_code/test_quadratic_function.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/tensor/conv/c_code/corr3d_gemm.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/tensor/conv/c_code/corr_gemm.c +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_breakpoint.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_gradient.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_ifelse.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_printing.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_raise_op.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_rop.py +0 -0
- {pytensor-2.25.3 → pytensor-2.25.5}/tests/test_updates.py +0 -0
|
@@ -152,7 +152,7 @@ This distance between consecutive elements of an array over a given dimension,
|
|
|
152
152
|
is called the stride of that dimension.
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
Accessing NumPy :class`
|
|
155
|
+
Accessing NumPy :class:`ndarray`'s data and properties
|
|
156
156
|
------------------------------------------------------
|
|
157
157
|
|
|
158
158
|
The following macros serve to access various attributes of NumPy :class:`ndarray`\s.
|
|
@@ -4,7 +4,7 @@ Adding JAX, Numba and Pytorch support for `Op`\s
|
|
|
4
4
|
PyTensor is able to convert its graphs into JAX, Numba and Pytorch compiled functions. In order to do
|
|
5
5
|
this, each :class:`Op` in an PyTensor graph must have an equivalent JAX/Numba/Pytorch implementation function.
|
|
6
6
|
|
|
7
|
-
This tutorial will explain how JAX, Numba and Pytorch implementations are created for an :class:`Op`.
|
|
7
|
+
This tutorial will explain how JAX, Numba and Pytorch implementations are created for an :class:`Op`.
|
|
8
8
|
|
|
9
9
|
Step 1: Identify the PyTensor :class:`Op` you'd like to implement
|
|
10
10
|
------------------------------------------------------------------------
|
|
@@ -60,7 +60,7 @@ could also have any data type (e.g. floats, ints), so our implementation
|
|
|
60
60
|
must be able to handle all the possible data types.
|
|
61
61
|
|
|
62
62
|
It also tells us that there's only one return value, that it has a data type
|
|
63
|
-
determined by :meth:`x.type
|
|
63
|
+
determined by :meth:`x.type` i.e., the data type of the original tensor.
|
|
64
64
|
This implies that the result is necessarily a matrix.
|
|
65
65
|
|
|
66
66
|
Some class may have a more complex behavior. For example, the :class:`CumOp`\ :class:`Op`
|
|
@@ -116,7 +116,7 @@ Here's an example for :class:`DimShuffle`:
|
|
|
116
116
|
|
|
117
117
|
.. tab-set::
|
|
118
118
|
|
|
119
|
-
.. tab-item:: JAX
|
|
119
|
+
.. tab-item:: JAX
|
|
120
120
|
|
|
121
121
|
.. code:: python
|
|
122
122
|
|
|
@@ -134,7 +134,7 @@ Here's an example for :class:`DimShuffle`:
|
|
|
134
134
|
res = jnp.copy(res)
|
|
135
135
|
|
|
136
136
|
return res
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
.. tab-item:: Numba
|
|
139
139
|
|
|
140
140
|
.. code:: python
|
|
@@ -465,7 +465,7 @@ Step 4: Write tests
|
|
|
465
465
|
.. tab-item:: JAX
|
|
466
466
|
|
|
467
467
|
Test that your registered `Op` is working correctly by adding tests to the
|
|
468
|
-
appropriate test suites in PyTensor (e.g. in ``tests.link.jax``).
|
|
468
|
+
appropriate test suites in PyTensor (e.g. in ``tests.link.jax``).
|
|
469
469
|
The tests should ensure that your implementation can
|
|
470
470
|
handle the appropriate types of inputs and produce outputs equivalent to `Op.perform`.
|
|
471
471
|
Check the existing tests for the general outline of these kinds of tests. In
|
|
@@ -478,7 +478,7 @@ Step 4: Write tests
|
|
|
478
478
|
Here's a small example of a test for :class:`CumOp` above:
|
|
479
479
|
|
|
480
480
|
.. code:: python
|
|
481
|
-
|
|
481
|
+
|
|
482
482
|
import numpy as np
|
|
483
483
|
import pytensor.tensor as pt
|
|
484
484
|
from pytensor.configdefaults import config
|
|
@@ -514,22 +514,22 @@ Step 4: Write tests
|
|
|
514
514
|
.. code:: python
|
|
515
515
|
|
|
516
516
|
import pytest
|
|
517
|
-
|
|
517
|
+
|
|
518
518
|
def test_jax_CumOp():
|
|
519
519
|
"""Test JAX conversion of the `CumOp` `Op`."""
|
|
520
520
|
a = pt.matrix("a")
|
|
521
521
|
a.tag.test_value = np.arange(9, dtype=config.floatX).reshape((3, 3))
|
|
522
|
-
|
|
522
|
+
|
|
523
523
|
with pytest.raises(NotImplementedError):
|
|
524
524
|
out = pt.cumprod(a, axis=1)
|
|
525
525
|
fgraph = FunctionGraph([a], [out])
|
|
526
526
|
compare_jax_and_py(fgraph, [get_test_value(i) for i in fgraph.inputs])
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
|
|
528
|
+
|
|
529
529
|
.. tab-item:: Numba
|
|
530
530
|
|
|
531
531
|
Test that your registered `Op` is working correctly by adding tests to the
|
|
532
|
-
appropriate test suites in PyTensor (e.g. in ``tests.link.numba``).
|
|
532
|
+
appropriate test suites in PyTensor (e.g. in ``tests.link.numba``).
|
|
533
533
|
The tests should ensure that your implementation can
|
|
534
534
|
handle the appropriate types of inputs and produce outputs equivalent to `Op.perform`.
|
|
535
535
|
Check the existing tests for the general outline of these kinds of tests. In
|
|
@@ -542,7 +542,7 @@ Step 4: Write tests
|
|
|
542
542
|
Here's a small example of a test for :class:`CumOp` above:
|
|
543
543
|
|
|
544
544
|
.. code:: python
|
|
545
|
-
|
|
545
|
+
|
|
546
546
|
from tests.link.numba.test_basic import compare_numba_and_py
|
|
547
547
|
from pytensor.graph import FunctionGraph
|
|
548
548
|
from pytensor.compile.sharedvalue import SharedVariable
|
|
@@ -561,11 +561,11 @@ Step 4: Write tests
|
|
|
561
561
|
if not isinstance(i, SharedVariable | Constant)
|
|
562
562
|
],
|
|
563
563
|
)
|
|
564
|
-
|
|
564
|
+
|
|
565
565
|
|
|
566
566
|
|
|
567
567
|
.. tab-item:: Pytorch
|
|
568
|
-
|
|
568
|
+
|
|
569
569
|
Test that your registered `Op` is working correctly by adding tests to the
|
|
570
570
|
appropriate test suites in PyTensor (``tests.link.pytorch``). The tests should ensure that your implementation can
|
|
571
571
|
handle the appropriate types of inputs and produce outputs equivalent to `Op.perform`.
|
|
@@ -579,7 +579,7 @@ Step 4: Write tests
|
|
|
579
579
|
Here's a small example of a test for :class:`CumOp` above:
|
|
580
580
|
|
|
581
581
|
.. code:: python
|
|
582
|
-
|
|
582
|
+
|
|
583
583
|
import numpy as np
|
|
584
584
|
import pytest
|
|
585
585
|
import pytensor.tensor as pt
|
|
@@ -592,7 +592,7 @@ Step 4: Write tests
|
|
|
592
592
|
["float64", "int64"],
|
|
593
593
|
)
|
|
594
594
|
@pytest.mark.parametrize(
|
|
595
|
-
"axis",
|
|
595
|
+
"axis",
|
|
596
596
|
[None, 1, (0,)],
|
|
597
597
|
)
|
|
598
598
|
def test_pytorch_CumOp(axis, dtype):
|
|
@@ -650,4 +650,4 @@ as reported in issue `#654 <https://github.com/pymc-devs/pytensor/issues/654>`_.
|
|
|
650
650
|
All jitted functions now must have constant shape, which means a graph like the
|
|
651
651
|
one of :class:`Eye` can never be translated to JAX, since it's fundamentally a
|
|
652
652
|
function with dynamic shapes. In other words, only PyTensor graphs with static shapes
|
|
653
|
-
can be translated to JAX at the moment.
|
|
653
|
+
can be translated to JAX at the moment.
|
|
@@ -333,7 +333,7 @@ returns eitehr a new transferred variable (which can be the same as
|
|
|
333
333
|
the input if no transfer is necessary) or returns None if the transfer
|
|
334
334
|
can't be done.
|
|
335
335
|
|
|
336
|
-
Then register that function by calling :func:`register_transfer
|
|
336
|
+
Then register that function by calling :func:`register_transfer`
|
|
337
337
|
with it as argument.
|
|
338
338
|
|
|
339
339
|
An example
|
|
@@ -36,7 +36,7 @@ The ``inputs`` argument to ``pytensor.function`` is a list, containing the ``Var
|
|
|
36
36
|
``self.<name>``. The default value is ``None``.
|
|
37
37
|
|
|
38
38
|
``value``: literal or ``Container``. The initial/default value for this
|
|
39
|
-
input. If update is``
|
|
39
|
+
input. If update is ``None``, this input acts just like
|
|
40
40
|
an argument with a default value in Python. If update is not ``None``,
|
|
41
41
|
changes to this
|
|
42
42
|
value will "stick around", whether due to an update or a user's
|
|
@@ -226,7 +226,7 @@ import ``pytensor`` and print the config variable, as in:
|
|
|
226
226
|
in the future.
|
|
227
227
|
|
|
228
228
|
The ``'numpy+floatX'`` setting attempts to mimic NumPy casting rules,
|
|
229
|
-
although it prefers to use ``float32
|
|
229
|
+
although it prefers to use ``float32`` numbers instead of ``float64`` when
|
|
230
230
|
``config.floatX`` is set to ``'float32'`` and the associated data is not
|
|
231
231
|
explicitly typed as ``float64`` (e.g. regular Python floats). Note that
|
|
232
232
|
``'numpy+floatX'`` is not currently behaving exactly as planned (it is a
|
|
@@ -908,8 +908,8 @@ Reductions
|
|
|
908
908
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
909
909
|
:Parameter: *axis* - axis or axes along which to compute the maximum
|
|
910
910
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
left in the result as dimensions with size one. With this option, the result
|
|
912
|
+
will broadcast correctly against the original tensor.
|
|
913
913
|
:Returns: maximum of *x* along *axis*
|
|
914
914
|
|
|
915
915
|
axis can be:
|
|
@@ -922,8 +922,8 @@ Reductions
|
|
|
922
922
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
923
923
|
:Parameter: *axis* - axis along which to compute the index of the maximum
|
|
924
924
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axis which is reduced is
|
|
925
|
-
|
|
926
|
-
|
|
925
|
+
left in the result as a dimension with size one. With this option, the result
|
|
926
|
+
will broadcast correctly against the original tensor.
|
|
927
927
|
:Returns: the index of the maximum value along a given axis
|
|
928
928
|
|
|
929
929
|
if ``axis == None``, `argmax` over the flattened tensor (like NumPy)
|
|
@@ -933,8 +933,8 @@ Reductions
|
|
|
933
933
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
934
934
|
:Parameter: *axis* - axis along which to compute the maximum and its index
|
|
935
935
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axis which is reduced is
|
|
936
|
-
|
|
937
|
-
|
|
936
|
+
left in the result as a dimension with size one. With this option, the result
|
|
937
|
+
will broadcast correctly against the original tensor.
|
|
938
938
|
:Returns: the maximum value along a given axis and its index.
|
|
939
939
|
|
|
940
940
|
if ``axis == None``, `max_and_argmax` over the flattened tensor (like NumPy)
|
|
@@ -944,8 +944,8 @@ Reductions
|
|
|
944
944
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
945
945
|
:Parameter: *axis* - axis or axes along which to compute the minimum
|
|
946
946
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
947
|
-
|
|
948
|
-
|
|
947
|
+
left in the result as dimensions with size one. With this option, the result
|
|
948
|
+
will broadcast correctly against the original tensor.
|
|
949
949
|
:Returns: minimum of *x* along *axis*
|
|
950
950
|
|
|
951
951
|
`axis` can be:
|
|
@@ -958,8 +958,8 @@ Reductions
|
|
|
958
958
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
959
959
|
:Parameter: *axis* - axis along which to compute the index of the minimum
|
|
960
960
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
961
|
-
|
|
962
|
-
|
|
961
|
+
left in the result as dimensions with size one. With this option, the result
|
|
962
|
+
will broadcast correctly against the original tensor.
|
|
963
963
|
:Returns: the index of the minimum value along a given axis
|
|
964
964
|
|
|
965
965
|
if ``axis == None``, `argmin` over the flattened tensor (like NumPy)
|
|
@@ -980,8 +980,8 @@ Reductions
|
|
|
980
980
|
This default dtype does _not_ depend on the value of "acc_dtype".
|
|
981
981
|
|
|
982
982
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
983
|
-
|
|
984
|
-
|
|
983
|
+
left in the result as dimensions with size one. With this option, the result
|
|
984
|
+
will broadcast correctly against the original tensor.
|
|
985
985
|
|
|
986
986
|
:Parameter: *acc_dtype* - The dtype of the internal accumulator.
|
|
987
987
|
If None (default), we use the dtype in the list below,
|
|
@@ -1015,8 +1015,8 @@ Reductions
|
|
|
1015
1015
|
This default dtype does _not_ depend on the value of "acc_dtype".
|
|
1016
1016
|
|
|
1017
1017
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1018
|
-
|
|
1019
|
-
|
|
1018
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1019
|
+
will broadcast correctly against the original tensor.
|
|
1020
1020
|
|
|
1021
1021
|
:Parameter: *acc_dtype* - The dtype of the internal accumulator.
|
|
1022
1022
|
If None (default), we use the dtype in the list below,
|
|
@@ -1031,16 +1031,16 @@ Reductions
|
|
|
1031
1031
|
as we need to handle 3 different cases: without zeros in the
|
|
1032
1032
|
input reduced group, with 1 zero or with more zeros.
|
|
1033
1033
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1034
|
+
This could slow you down, but more importantly, we currently
|
|
1035
|
+
don't support the second derivative of the 3 cases. So you
|
|
1036
|
+
cannot take the second derivative of the default prod().
|
|
1037
1037
|
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1038
|
+
To remove the handling of the special cases of 0 and so get
|
|
1039
|
+
some small speed up and allow second derivative set
|
|
1040
|
+
``no_zeros_in_inputs`` to ``True``. It defaults to ``False``.
|
|
1041
1041
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1042
|
+
**It is the user responsibility to make sure there are no zeros
|
|
1043
|
+
in the inputs. If there are, the grad will be wrong.**
|
|
1044
1044
|
|
|
1045
1045
|
:Returns: product of every term in *x* along *axis*
|
|
1046
1046
|
|
|
@@ -1058,13 +1058,13 @@ Reductions
|
|
|
1058
1058
|
done in float64 (acc_dtype would be float64 by default),
|
|
1059
1059
|
but that result will be casted back in float32.
|
|
1060
1060
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1061
|
-
|
|
1062
|
-
|
|
1061
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1062
|
+
will broadcast correctly against the original tensor.
|
|
1063
1063
|
:Parameter: *acc_dtype* - The dtype of the internal accumulator of the
|
|
1064
1064
|
inner summation. This will not necessarily be the dtype of the
|
|
1065
1065
|
output (in particular if it is a discrete (int/uint) dtype, the
|
|
1066
1066
|
output will be in a float type). If None, then we use the same
|
|
1067
|
-
rules as :func:`sum
|
|
1067
|
+
rules as :func:`sum`.
|
|
1068
1068
|
:Returns: mean value of *x* along *axis*
|
|
1069
1069
|
|
|
1070
1070
|
`axis` can be:
|
|
@@ -1077,8 +1077,8 @@ Reductions
|
|
|
1077
1077
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
1078
1078
|
:Parameter: *axis* - axis or axes along which to compute the variance
|
|
1079
1079
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1080
|
-
|
|
1081
|
-
|
|
1080
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1081
|
+
will broadcast correctly against the original tensor.
|
|
1082
1082
|
:Returns: variance of *x* along *axis*
|
|
1083
1083
|
|
|
1084
1084
|
`axis` can be:
|
|
@@ -1091,8 +1091,8 @@ Reductions
|
|
|
1091
1091
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
1092
1092
|
:Parameter: *axis* - axis or axes along which to compute the standard deviation
|
|
1093
1093
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1094
|
-
|
|
1095
|
-
|
|
1094
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1095
|
+
will broadcast correctly against the original tensor.
|
|
1096
1096
|
:Returns: variance of *x* along *axis*
|
|
1097
1097
|
|
|
1098
1098
|
`axis` can be:
|
|
@@ -1105,8 +1105,8 @@ Reductions
|
|
|
1105
1105
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
1106
1106
|
:Parameter: *axis* - axis or axes along which to apply 'bitwise and'
|
|
1107
1107
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1108
|
-
|
|
1109
|
-
|
|
1108
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1109
|
+
will broadcast correctly against the original tensor.
|
|
1110
1110
|
:Returns: bitwise and of *x* along *axis*
|
|
1111
1111
|
|
|
1112
1112
|
`axis` can be:
|
|
@@ -1119,8 +1119,8 @@ Reductions
|
|
|
1119
1119
|
:Parameter: *x* - symbolic Tensor (or compatible)
|
|
1120
1120
|
:Parameter: *axis* - axis or axes along which to apply bitwise or
|
|
1121
1121
|
:Parameter: *keepdims* - (boolean) If this is set to True, the axes which are reduced are
|
|
1122
|
-
|
|
1123
|
-
|
|
1122
|
+
left in the result as dimensions with size one. With this option, the result
|
|
1123
|
+
will broadcast correctly against the original tensor.
|
|
1124
1124
|
:Returns: bitwise or of *x* along *axis*
|
|
1125
1125
|
|
|
1126
1126
|
`axis` can be:
|
|
@@ -1745,7 +1745,7 @@ Linear Algebra
|
|
|
1745
1745
|
when indexed, so that each returned argument has the same shape.
|
|
1746
1746
|
The dimensions and number of the output arrays are equal to the
|
|
1747
1747
|
number of indexing dimensions. If the step length is not a complex
|
|
1748
|
-
|
|
1748
|
+
number, then the stop is not inclusive.
|
|
1749
1749
|
|
|
1750
1750
|
Example:
|
|
1751
1751
|
|
|
@@ -262,8 +262,8 @@ Optimization o4 o3 o2
|
|
|
262
262
|
local_remove_all_assert
|
|
263
263
|
This is an unsafe optimization.
|
|
264
264
|
For the fastest possible PyTensor, this optimization can be enabled by
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
setting ``optimizer_including=local_remove_all_assert`` which will
|
|
266
|
+
remove all assertions in the graph for checking user inputs are valid.
|
|
267
267
|
Use this optimization if you are sure everything is valid in your graph.
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
See :ref:`unsafe_rewrites`
|
|
@@ -7,12 +7,12 @@ Baby Steps - Algebra
|
|
|
7
7
|
Understanding Tensors
|
|
8
8
|
===========================
|
|
9
9
|
|
|
10
|
-
Before diving into PyTensor, it's essential to understand the fundamental
|
|
11
|
-
data structure it operates on: the *tensor*. A *tensor* is a multi-dimensional
|
|
10
|
+
Before diving into PyTensor, it's essential to understand the fundamental
|
|
11
|
+
data structure it operates on: the *tensor*. A *tensor* is a multi-dimensional
|
|
12
12
|
array that serves as the foundation for symbolic computations.
|
|
13
13
|
|
|
14
|
-
tensors can represent anything from a single number (scalar) to
|
|
15
|
-
complex multi-dimensional arrays. Each tensor has a type that dictates its
|
|
14
|
+
tensors can represent anything from a single number (scalar) to
|
|
15
|
+
complex multi-dimensional arrays. Each tensor has a type that dictates its
|
|
16
16
|
dimensionality and the kind of data it holds.
|
|
17
17
|
|
|
18
18
|
For example, the following code creates a symbolic scalar and a symbolic matrix:
|
|
@@ -20,11 +20,11 @@ For example, the following code creates a symbolic scalar and a symbolic matrix:
|
|
|
20
20
|
>>> x = pt.scalar('x')
|
|
21
21
|
>>> y = pt.matrix('y')
|
|
22
22
|
|
|
23
|
-
Here, `scalar` refers to a tensor with zero dimensions, while `matrix` refers
|
|
24
|
-
to a tensor with two dimensions. The same principles apply to tensors of other
|
|
23
|
+
Here, `scalar` refers to a tensor with zero dimensions, while `matrix` refers
|
|
24
|
+
to a tensor with two dimensions. The same principles apply to tensors of other
|
|
25
25
|
dimensions.
|
|
26
26
|
|
|
27
|
-
For more information about tensors and their associated operations can be
|
|
27
|
+
For more information about tensors and their associated operations can be
|
|
28
28
|
found here: :ref:`tensor <libdoc_tensor>`.
|
|
29
29
|
|
|
30
30
|
|
|
@@ -51,10 +51,10 @@ In the long-run this deterministic mapping function should produce draws that ar
|
|
|
51
51
|
For illustration we implement a very bad mapping function from a bit generator to uniform draws.
|
|
52
52
|
|
|
53
53
|
.. code:: python
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
def bad_uniform_rng(rng, size):
|
|
56
56
|
bit_generator = rng.bit_generator
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
uniform_draws = np.empty(size)
|
|
59
59
|
for i in range(size):
|
|
60
60
|
bit_generator.advance(1)
|
|
@@ -175,9 +175,9 @@ Shared variables are global variables that don't need (and can't) be passed as e
|
|
|
175
175
|
|
|
176
176
|
>>> rng = pytensor.shared(np.random.default_rng(123))
|
|
177
177
|
>>> next_rng, x = pt.random.uniform(rng=rng).owner.outputs
|
|
178
|
-
>>>
|
|
178
|
+
>>>
|
|
179
179
|
>>> f = pytensor.function([], [next_rng, x])
|
|
180
|
-
>>>
|
|
180
|
+
>>>
|
|
181
181
|
>>> next_rng_val, x = f()
|
|
182
182
|
>>> print(x)
|
|
183
183
|
0.6823518632481435
|
|
@@ -200,9 +200,9 @@ In this case it makes sense to simply replace the original value by the next_rng
|
|
|
200
200
|
|
|
201
201
|
>>> rng = pytensor.shared(np.random.default_rng(123))
|
|
202
202
|
>>> next_rng, x = pt.random.uniform(rng=rng).owner.outputs
|
|
203
|
-
>>>
|
|
203
|
+
>>>
|
|
204
204
|
>>> f = pytensor.function([], x, updates={rng: next_rng})
|
|
205
|
-
>>>
|
|
205
|
+
>>>
|
|
206
206
|
>>> f(), f(), f()
|
|
207
207
|
(array(0.68235186), array(0.05382102), array(0.22035987))
|
|
208
208
|
|
|
@@ -210,10 +210,10 @@ Another way of doing that is setting a default_update in the shared RNG variable
|
|
|
210
210
|
|
|
211
211
|
>>> rng = pytensor.shared(np.random.default_rng(123))
|
|
212
212
|
>>> next_rng, x = pt.random.uniform(rng=rng).owner.outputs
|
|
213
|
-
>>>
|
|
213
|
+
>>>
|
|
214
214
|
>>> rng.default_update = next_rng
|
|
215
215
|
>>> f = pytensor.function([], x)
|
|
216
|
-
>>>
|
|
216
|
+
>>>
|
|
217
217
|
>>> f(), f(), f()
|
|
218
218
|
(array(0.68235186), array(0.05382102), array(0.22035987))
|
|
219
219
|
|
|
@@ -232,12 +232,12 @@ the SciPy-like API of `pytensor.tensor.random`. Full documentation can be found
|
|
|
232
232
|
>>> print(f(), f(), f())
|
|
233
233
|
0.19365083425294516 0.7541389670292019 0.2762903411491048
|
|
234
234
|
|
|
235
|
-
Shared RNGs are created by default
|
|
235
|
+
Shared RNGs are created by default
|
|
236
236
|
----------------------------------
|
|
237
237
|
|
|
238
238
|
If no rng is provided to a RandomVariable Op, a shared RandomGenerator is created automatically.
|
|
239
239
|
|
|
240
|
-
This can give the appearance that PyTensor functions of random variables don't have any variable inputs,
|
|
240
|
+
This can give the appearance that PyTensor functions of random variables don't have any variable inputs,
|
|
241
241
|
but this is not true.
|
|
242
242
|
They are simply shared variables.
|
|
243
243
|
|
|
@@ -252,10 +252,10 @@ Shared RNG variables can be "reseeded" by setting them to the original RNG
|
|
|
252
252
|
|
|
253
253
|
>>> rng = pytensor.shared(np.random.default_rng(123))
|
|
254
254
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
255
|
-
>>>
|
|
255
|
+
>>>
|
|
256
256
|
>>> rng.default_update = next_rng
|
|
257
257
|
>>> f = pytensor.function([], x)
|
|
258
|
-
>>>
|
|
258
|
+
>>>
|
|
259
259
|
>>> print(f(), f())
|
|
260
260
|
>>> rng.set_value(np.random.default_rng(123))
|
|
261
261
|
>>> print(f(), f())
|
|
@@ -267,7 +267,7 @@ RandomStreams provide a helper method to achieve the same
|
|
|
267
267
|
>>> rng = pt.random.RandomStream(seed=123)
|
|
268
268
|
>>> x = srng.normal()
|
|
269
269
|
>>> f = pytensor.function([], x)
|
|
270
|
-
>>>
|
|
270
|
+
>>>
|
|
271
271
|
>>> print(f(), f())
|
|
272
272
|
>>> srng.seed(123)
|
|
273
273
|
>>> print(f(), f())
|
|
@@ -373,7 +373,7 @@ uniform_rv{"(),()->()"}.1 [id A] d={0: [0]} 0
|
|
|
373
373
|
|
|
374
374
|
>>> rng = pytensor.shared(np.random.default_rng(), name="rng")
|
|
375
375
|
>>> next_rng, x = pt.random.uniform(rng=rng).owner.outputs
|
|
376
|
-
>>>
|
|
376
|
+
>>>
|
|
377
377
|
>>> inplace_f = pytensor.function([], [x], updates={rng: next_rng})
|
|
378
378
|
>>> pytensor.dprint(inplace_f, print_destroy_map=True) # doctest: +SKIP
|
|
379
379
|
uniform_rv{"(),()->()"}.1 [id A] d={0: [0]} 0
|
|
@@ -392,15 +392,15 @@ It's common practice to use separate RNG variables for each RandomVariable in Py
|
|
|
392
392
|
|
|
393
393
|
>>> rng_x = pytensor.shared(np.random.default_rng(123), name="rng_x")
|
|
394
394
|
>>> rng_y = pytensor.shared(np.random.default_rng(456), name="rng_y")
|
|
395
|
-
>>>
|
|
395
|
+
>>>
|
|
396
396
|
>>> next_rng_x, x = pt.random.normal(loc=0, scale=10, rng=rng_x).owner.outputs
|
|
397
397
|
>>> next_rng_y, y = pt.random.normal(loc=x, scale=0.1, rng=rng_y).owner.outputs
|
|
398
|
-
>>>
|
|
398
|
+
>>>
|
|
399
399
|
>>> next_rng_x.name = "next_rng_x"
|
|
400
400
|
>>> next_rng_y.name = "next_rng_y"
|
|
401
401
|
>>> rng_x.default_update = next_rng_x
|
|
402
402
|
>>> rng_y.default_update = next_rng_y
|
|
403
|
-
>>>
|
|
403
|
+
>>>
|
|
404
404
|
>>> f = pytensor.function([], [x, y])
|
|
405
405
|
>>> pytensor.dprint(f, print_type=True) # doctest: +SKIP
|
|
406
406
|
normal_rv{"(),()->()"}.1 [id A] <Scalar(float64, shape=())> 0
|
|
@@ -430,7 +430,7 @@ This is what RandomStream does as well
|
|
|
430
430
|
>>> srng = pt.random.RandomStream(seed=123)
|
|
431
431
|
>>> x = srng.normal(loc=0, scale=10)
|
|
432
432
|
>>> y = srng.normal(loc=x, scale=0.1)
|
|
433
|
-
>>>
|
|
433
|
+
>>>
|
|
434
434
|
>>> f = pytensor.function([], [x, y])
|
|
435
435
|
>>> pytensor.dprint(f, print_type=True) # doctest: +SKIP
|
|
436
436
|
normal_rv{"(),()->()"}.1 [id A] <Scalar(float64, shape=())> 0
|
|
@@ -462,7 +462,7 @@ We could have used a single rng.
|
|
|
462
462
|
>>> next_rng_x.name = "next_rng_x"
|
|
463
463
|
>>> next_rng_y, y = pt.random.normal(loc=100, scale=1, rng=next_rng_x).owner.outputs
|
|
464
464
|
>>> next_rng_y.name = "next_rng_y"
|
|
465
|
-
>>>
|
|
465
|
+
>>>
|
|
466
466
|
>>> f = pytensor.function([], [x, y], updates={rng: next_rng_y})
|
|
467
467
|
>>> pytensor.dprint(f, print_type=True) # doctest: +SKIP
|
|
468
468
|
normal_rv{"(),()->()"}.1 [id A] <Scalar(float64, shape=())> 0
|
|
@@ -508,10 +508,10 @@ Scan works very similar to a function (that is called repeatedly inside an outer
|
|
|
508
508
|
This means that random variables will always return the same output unless updates are specified.
|
|
509
509
|
|
|
510
510
|
>>> rng = pytensor.shared(np.random.default_rng(123), name="rng")
|
|
511
|
-
>>>
|
|
511
|
+
>>>
|
|
512
512
|
>>> def constant_step(rng):
|
|
513
513
|
>>> return pt.random.normal(rng=rng)
|
|
514
|
-
>>>
|
|
514
|
+
>>>
|
|
515
515
|
>>> draws, updates = pytensor.scan(
|
|
516
516
|
>>> fn=constant_step,
|
|
517
517
|
>>> outputs_info=[None],
|
|
@@ -519,7 +519,7 @@ This means that random variables will always return the same output unless updat
|
|
|
519
519
|
>>> n_steps=5,
|
|
520
520
|
>>> strict=True,
|
|
521
521
|
>>> )
|
|
522
|
-
>>>
|
|
522
|
+
>>>
|
|
523
523
|
>>> f = pytensor.function([], draws, updates=updates)
|
|
524
524
|
>>> f(), f()
|
|
525
525
|
(array([-0.98912135, -0.98912135, -0.98912135, -0.98912135, -0.98912135]),
|
|
@@ -528,12 +528,12 @@ This means that random variables will always return the same output unless updat
|
|
|
528
528
|
Scan accepts an update dictionary as an output to tell how shared variables should be updated after every iteration.
|
|
529
529
|
|
|
530
530
|
>>> rng = pytensor.shared(np.random.default_rng(123))
|
|
531
|
-
>>>
|
|
531
|
+
>>>
|
|
532
532
|
>>> def random_step(rng):
|
|
533
533
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
534
534
|
>>> scan_update = {rng: next_rng}
|
|
535
535
|
>>> return x, scan_update
|
|
536
|
-
>>>
|
|
536
|
+
>>>
|
|
537
537
|
>>> draws, updates = pytensor.scan(
|
|
538
538
|
>>> fn=random_step,
|
|
539
539
|
>>> outputs_info=[None],
|
|
@@ -541,7 +541,7 @@ Scan accepts an update dictionary as an output to tell how shared variables shou
|
|
|
541
541
|
>>> n_steps=5,
|
|
542
542
|
>>> strict=True
|
|
543
543
|
>>> )
|
|
544
|
-
>>>
|
|
544
|
+
>>>
|
|
545
545
|
>>> f = pytensor.function([], draws)
|
|
546
546
|
>>> f(), f()
|
|
547
547
|
(array([-0.98912135, -0.36778665, 1.28792526, 0.19397442, 0.9202309 ]),
|
|
@@ -563,7 +563,7 @@ Like function, scan also respects shared variables default updates
|
|
|
563
563
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
564
564
|
>>> rng.default_update = next_rng
|
|
565
565
|
>>> return x
|
|
566
|
-
>>>
|
|
566
|
+
>>>
|
|
567
567
|
>>> draws, updates = pytensor.scan(
|
|
568
568
|
>>> fn=random_step,
|
|
569
569
|
>>> outputs_info=[None],
|
|
@@ -589,10 +589,10 @@ As expected, Scan only looks at default updates for shared variables created ins
|
|
|
589
589
|
>>> rng = pytensor.shared(np.random.default_rng(123), name="rng")
|
|
590
590
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
591
591
|
>>> rng.default_update = next_rng
|
|
592
|
-
>>>
|
|
593
|
-
>>> def random_step(rng, x):
|
|
592
|
+
>>>
|
|
593
|
+
>>> def random_step(rng, x):
|
|
594
594
|
>>> return x
|
|
595
|
-
>>>
|
|
595
|
+
>>>
|
|
596
596
|
>>> draws, updates = pytensor.scan(
|
|
597
597
|
>>> fn=random_step,
|
|
598
598
|
>>> outputs_info=[None],
|
|
@@ -611,11 +611,11 @@ As expected, Scan only looks at default updates for shared variables created ins
|
|
|
611
611
|
RNGs in Scan are only supported via shared variables in non-sequences at the moment
|
|
612
612
|
|
|
613
613
|
>>> rng = pt.random.type.RandomGeneratorType()("rng")
|
|
614
|
-
>>>
|
|
614
|
+
>>>
|
|
615
615
|
>>> def random_step(rng):
|
|
616
616
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
617
617
|
>>> return next_rng, x
|
|
618
|
-
>>>
|
|
618
|
+
>>>
|
|
619
619
|
>>> try:
|
|
620
620
|
>>> (next_rngs, draws), updates = pytensor.scan(
|
|
621
621
|
>>> fn=random_step,
|
|
@@ -635,21 +635,21 @@ OpFromGraph
|
|
|
635
635
|
In contrast to Scan, non-shared RNG variables can be used directly in OpFromGraph
|
|
636
636
|
|
|
637
637
|
>>> from pytensor.compile.builders import OpFromGraph
|
|
638
|
-
>>>
|
|
638
|
+
>>>
|
|
639
639
|
>>> rng = pt.random.type.RandomGeneratorType()("rng")
|
|
640
|
-
>>>
|
|
640
|
+
>>>
|
|
641
641
|
>>> def lognormal(rng):
|
|
642
642
|
>>> next_rng, x = pt.random.normal(rng=rng).owner.outputs
|
|
643
643
|
>>> return [next_rng, pt.exp(x)]
|
|
644
|
-
>>>
|
|
644
|
+
>>>
|
|
645
645
|
>>> lognormal_ofg = OpFromGraph([rng], lognormal(rng))
|
|
646
646
|
|
|
647
647
|
>>> rng_x = pytensor.shared(np.random.default_rng(1), name="rng_x")
|
|
648
648
|
>>> rng_y = pytensor.shared(np.random.default_rng(2), name="rng_y")
|
|
649
|
-
>>>
|
|
649
|
+
>>>
|
|
650
650
|
>>> next_rng_x, x = lognormal_ofg(rng_x)
|
|
651
|
-
>>> next_rng_y, y = lognormal_ofg(rng_y)
|
|
652
|
-
>>>
|
|
651
|
+
>>> next_rng_y, y = lognormal_ofg(rng_y)
|
|
652
|
+
>>>
|
|
653
653
|
>>> f = pytensor.function([], [x, y], updates={rng_x: next_rng_x, rng_y: next_rng_y})
|
|
654
654
|
|
|
655
655
|
>>> f(), f(), f()
|
|
@@ -749,4 +749,4 @@ PyTensor could provide shared JAX-like RNGs and allow RandomVariables to accept
|
|
|
749
749
|
but that would break the spirit of one graph `->` multiple backends.
|
|
750
750
|
|
|
751
751
|
Alternatively, PyTensor could try to use a more general type for RNGs that can be used across different backends,
|
|
752
|
-
either directly or after some conversion operation (if such operations can be implemented in the different backends).
|
|
752
|
+
either directly or after some conversion operation (if such operations can be implemented in the different backends).
|
|
@@ -124,6 +124,9 @@ testpaths = "tests/"
|
|
|
124
124
|
line-length = 88
|
|
125
125
|
exclude = ["doc/", "pytensor/_version.py"]
|
|
126
126
|
|
|
127
|
+
[tool.ruff.format]
|
|
128
|
+
docstring-code-format = true
|
|
129
|
+
|
|
127
130
|
[tool.ruff.lint]
|
|
128
131
|
select = ["C", "E", "F", "I", "UP", "W", "RUF", "PERF", "PTH", "ISC"]
|
|
129
132
|
ignore = ["C408", "C901", "E501", "E741", "RUF012", "PERF203", "ISC001"]
|