pytensor 3.4.0__cp315-cp315-win_amd64.whl

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.
Files changed (439) hide show
  1. pytensor/__init__.py +61 -0
  2. pytensor/_sparse_lazy.py +31 -0
  3. pytensor/_version.py +21 -0
  4. pytensor/assumptions/__init__.py +108 -0
  5. pytensor/assumptions/alloc.py +181 -0
  6. pytensor/assumptions/blockwise.py +13 -0
  7. pytensor/assumptions/bundles.py +55 -0
  8. pytensor/assumptions/core.py +684 -0
  9. pytensor/assumptions/diagonal.py +153 -0
  10. pytensor/assumptions/dimshuffle.py +54 -0
  11. pytensor/assumptions/dot.py +58 -0
  12. pytensor/assumptions/elemwise.py +84 -0
  13. pytensor/assumptions/orthogonal.py +85 -0
  14. pytensor/assumptions/permutation.py +80 -0
  15. pytensor/assumptions/positive_definite.py +153 -0
  16. pytensor/assumptions/reshape.py +28 -0
  17. pytensor/assumptions/selection.py +131 -0
  18. pytensor/assumptions/shape.py +30 -0
  19. pytensor/assumptions/specify.py +189 -0
  20. pytensor/assumptions/subtensor.py +88 -0
  21. pytensor/assumptions/symmetric.py +129 -0
  22. pytensor/assumptions/triangular.py +203 -0
  23. pytensor/assumptions/tridiagonal.py +108 -0
  24. pytensor/assumptions/unit_magnitude.py +41 -0
  25. pytensor/basic.py +46 -0
  26. pytensor/bin/__init__.py +0 -0
  27. pytensor/bin/pytensor_cache.py +112 -0
  28. pytensor/breakpoint.py +161 -0
  29. pytensor/compile/__init__.py +65 -0
  30. pytensor/compile/aliasing.py +260 -0
  31. pytensor/compile/builders.py +980 -0
  32. pytensor/compile/compiledir.py +272 -0
  33. pytensor/compile/compilelock.py +87 -0
  34. pytensor/compile/debug/__init__.py +0 -0
  35. pytensor/compile/debug/debugmode.py +2310 -0
  36. pytensor/compile/debug/dump.py +75 -0
  37. pytensor/compile/debug/monitormode.py +111 -0
  38. pytensor/compile/debug/nanguardmode.py +260 -0
  39. pytensor/compile/debug/profiling.py +1573 -0
  40. pytensor/compile/executor.py +879 -0
  41. pytensor/compile/inner_function.py +74 -0
  42. pytensor/compile/io.py +255 -0
  43. pytensor/compile/maker.py +722 -0
  44. pytensor/compile/mode.py +633 -0
  45. pytensor/compile/ops.py +315 -0
  46. pytensor/compile/rebuild.py +548 -0
  47. pytensor/compile/rewriting.py +221 -0
  48. pytensor/compile/sharedvalue.py +229 -0
  49. pytensor/conditional/__init__.py +7 -0
  50. pytensor/conditional/op.py +455 -0
  51. pytensor/conditional/rewriting.py +651 -0
  52. pytensor/configdefaults.py +1143 -0
  53. pytensor/configparser.py +584 -0
  54. pytensor/d3viz/__init__.py +1 -0
  55. pytensor/d3viz/css/d3-context-menu.css +29 -0
  56. pytensor/d3viz/css/d3viz.css +98 -0
  57. pytensor/d3viz/d3viz.py +130 -0
  58. pytensor/d3viz/formatting.py +369 -0
  59. pytensor/d3viz/html/template.html +101 -0
  60. pytensor/d3viz/js/d3-context-menu.js +42 -0
  61. pytensor/d3viz/js/d3.v3.min.js +5 -0
  62. pytensor/d3viz/js/d3viz.js +969 -0
  63. pytensor/d3viz/js/dagre-d3.min.js +2 -0
  64. pytensor/d3viz/js/graphlib-dot.min.js +4 -0
  65. pytensor/gradient.py +2508 -0
  66. pytensor/graph/__init__.py +19 -0
  67. pytensor/graph/basic.py +1324 -0
  68. pytensor/graph/destroyhandler.py +788 -0
  69. pytensor/graph/features.py +959 -0
  70. pytensor/graph/fg.py +1253 -0
  71. pytensor/graph/null_type.py +42 -0
  72. pytensor/graph/op.py +780 -0
  73. pytensor/graph/replace.py +345 -0
  74. pytensor/graph/rewriting/__init__.py +4 -0
  75. pytensor/graph/rewriting/basic.py +3139 -0
  76. pytensor/graph/rewriting/db.py +547 -0
  77. pytensor/graph/rewriting/kanren.py +329 -0
  78. pytensor/graph/rewriting/reachability.py +135 -0
  79. pytensor/graph/rewriting/unify.py +594 -0
  80. pytensor/graph/rewriting/utils.py +116 -0
  81. pytensor/graph/traversal.py +783 -0
  82. pytensor/graph/type.py +242 -0
  83. pytensor/graph/utils.py +350 -0
  84. pytensor/ifelse.py +37 -0
  85. pytensor/ipython.py +215 -0
  86. pytensor/link/__init__.py +1 -0
  87. pytensor/link/basic.py +745 -0
  88. pytensor/link/c/__init__.py +0 -0
  89. pytensor/link/c/basic.py +2012 -0
  90. pytensor/link/c/c_code/lazylinker_c.c +1027 -0
  91. pytensor/link/c/c_code/pytensor_mod_helper.h +25 -0
  92. pytensor/link/c/cmodule.py +2937 -0
  93. pytensor/link/c/cutils.py +116 -0
  94. pytensor/link/c/cvm.py +29 -0
  95. pytensor/link/c/exceptions.py +12 -0
  96. pytensor/link/c/interface.py +632 -0
  97. pytensor/link/c/lazylinker_c.py +147 -0
  98. pytensor/link/c/op.py +646 -0
  99. pytensor/link/c/params_type.py +885 -0
  100. pytensor/link/c/type.py +787 -0
  101. pytensor/link/jax/__init__.py +1 -0
  102. pytensor/link/jax/dispatch/__init__.py +23 -0
  103. pytensor/link/jax/dispatch/basic.py +159 -0
  104. pytensor/link/jax/dispatch/blas.py +14 -0
  105. pytensor/link/jax/dispatch/blockwise.py +63 -0
  106. pytensor/link/jax/dispatch/einsum.py +20 -0
  107. pytensor/link/jax/dispatch/elemwise.py +107 -0
  108. pytensor/link/jax/dispatch/extra_ops.py +143 -0
  109. pytensor/link/jax/dispatch/linalg/__init__.py +8 -0
  110. pytensor/link/jax/dispatch/linalg/constructors.py +12 -0
  111. pytensor/link/jax/dispatch/linalg/decomposition.py +140 -0
  112. pytensor/link/jax/dispatch/linalg/inverse.py +20 -0
  113. pytensor/link/jax/dispatch/linalg/products.py +43 -0
  114. pytensor/link/jax/dispatch/linalg/solvers.py +103 -0
  115. pytensor/link/jax/dispatch/linalg/summary.py +20 -0
  116. pytensor/link/jax/dispatch/math.py +73 -0
  117. pytensor/link/jax/dispatch/pad.py +53 -0
  118. pytensor/link/jax/dispatch/random.py +454 -0
  119. pytensor/link/jax/dispatch/scalar.py +357 -0
  120. pytensor/link/jax/dispatch/scan.py +247 -0
  121. pytensor/link/jax/dispatch/shape.py +106 -0
  122. pytensor/link/jax/dispatch/signal/__init__.py +1 -0
  123. pytensor/link/jax/dispatch/signal/conv.py +24 -0
  124. pytensor/link/jax/dispatch/sort.py +26 -0
  125. pytensor/link/jax/dispatch/sparse.py +38 -0
  126. pytensor/link/jax/dispatch/subtensor.py +73 -0
  127. pytensor/link/jax/dispatch/tensor_basic.py +195 -0
  128. pytensor/link/jax/linker.py +142 -0
  129. pytensor/link/jax/ops.py +568 -0
  130. pytensor/link/mlx/__init__.py +1 -0
  131. pytensor/link/mlx/dispatch/__init__.py +21 -0
  132. pytensor/link/mlx/dispatch/basic.py +244 -0
  133. pytensor/link/mlx/dispatch/blas.py +42 -0
  134. pytensor/link/mlx/dispatch/blockwise.py +88 -0
  135. pytensor/link/mlx/dispatch/einsum.py +14 -0
  136. pytensor/link/mlx/dispatch/elemwise.py +133 -0
  137. pytensor/link/mlx/dispatch/extra_ops.py +35 -0
  138. pytensor/link/mlx/dispatch/linalg/__init__.py +7 -0
  139. pytensor/link/mlx/dispatch/linalg/decomposition.py +183 -0
  140. pytensor/link/mlx/dispatch/linalg/inverse.py +26 -0
  141. pytensor/link/mlx/dispatch/linalg/products.py +22 -0
  142. pytensor/link/mlx/dispatch/linalg/solvers.py +95 -0
  143. pytensor/link/mlx/dispatch/linalg/summary.py +40 -0
  144. pytensor/link/mlx/dispatch/math.py +82 -0
  145. pytensor/link/mlx/dispatch/pad.py +55 -0
  146. pytensor/link/mlx/dispatch/random.py +276 -0
  147. pytensor/link/mlx/dispatch/scalar/__init__.py +10 -0
  148. pytensor/link/mlx/dispatch/scalar/basic.py +127 -0
  149. pytensor/link/mlx/dispatch/scalar/bessel.py +508 -0
  150. pytensor/link/mlx/dispatch/scalar/beta.py +1131 -0
  151. pytensor/link/mlx/dispatch/scalar/erf.py +316 -0
  152. pytensor/link/mlx/dispatch/scalar/erfcinv.py +152 -0
  153. pytensor/link/mlx/dispatch/scalar/gamma.py +58 -0
  154. pytensor/link/mlx/dispatch/scalar/gammainc.py +552 -0
  155. pytensor/link/mlx/dispatch/scalar/helpers.py +214 -0
  156. pytensor/link/mlx/dispatch/scalar/math.py +271 -0
  157. pytensor/link/mlx/dispatch/shape.py +56 -0
  158. pytensor/link/mlx/dispatch/signal/__init__.py +0 -0
  159. pytensor/link/mlx/dispatch/signal/conv.py +33 -0
  160. pytensor/link/mlx/dispatch/sort.py +38 -0
  161. pytensor/link/mlx/dispatch/subtensor.py +118 -0
  162. pytensor/link/mlx/dispatch/tensor_basic.py +256 -0
  163. pytensor/link/mlx/linker.py +143 -0
  164. pytensor/link/numba/__init__.py +1 -0
  165. pytensor/link/numba/cache.py +207 -0
  166. pytensor/link/numba/dispatch/__init__.py +29 -0
  167. pytensor/link/numba/dispatch/_gamma_tables.py +821 -0
  168. pytensor/link/numba/dispatch/_llvmlite_self_ref.py +66 -0
  169. pytensor/link/numba/dispatch/_patch_list_to_tuple.py +330 -0
  170. pytensor/link/numba/dispatch/_patch_pointer_add.py +40 -0
  171. pytensor/link/numba/dispatch/array_utils.py +26 -0
  172. pytensor/link/numba/dispatch/basic.py +583 -0
  173. pytensor/link/numba/dispatch/blockwise.py +125 -0
  174. pytensor/link/numba/dispatch/compile_ops.py +178 -0
  175. pytensor/link/numba/dispatch/cython_support.py +197 -0
  176. pytensor/link/numba/dispatch/elemwise.py +1598 -0
  177. pytensor/link/numba/dispatch/extra_ops.py +351 -0
  178. pytensor/link/numba/dispatch/linalg/_BLAS.py +195 -0
  179. pytensor/link/numba/dispatch/linalg/_LAPACK.py +2003 -0
  180. pytensor/link/numba/dispatch/linalg/__init__.py +6 -0
  181. pytensor/link/numba/dispatch/linalg/constructors.py +90 -0
  182. pytensor/link/numba/dispatch/linalg/decomposition/__init__.py +0 -0
  183. pytensor/link/numba/dispatch/linalg/decomposition/cholesky.py +81 -0
  184. pytensor/link/numba/dispatch/linalg/decomposition/dispatch.py +671 -0
  185. pytensor/link/numba/dispatch/linalg/decomposition/eigen.py +1029 -0
  186. pytensor/link/numba/dispatch/linalg/decomposition/lu.py +192 -0
  187. pytensor/link/numba/dispatch/linalg/decomposition/lu_factor.py +90 -0
  188. pytensor/link/numba/dispatch/linalg/decomposition/qr.py +722 -0
  189. pytensor/link/numba/dispatch/linalg/decomposition/qz.py +1285 -0
  190. pytensor/link/numba/dispatch/linalg/decomposition/schur.py +225 -0
  191. pytensor/link/numba/dispatch/linalg/decomposition/svd.py +709 -0
  192. pytensor/link/numba/dispatch/linalg/inverse.py +40 -0
  193. pytensor/link/numba/dispatch/linalg/products.py +881 -0
  194. pytensor/link/numba/dispatch/linalg/solvers/__init__.py +0 -0
  195. pytensor/link/numba/dispatch/linalg/solvers/cholesky.py +85 -0
  196. pytensor/link/numba/dispatch/linalg/solvers/dispatch.py +189 -0
  197. pytensor/link/numba/dispatch/linalg/solvers/general.py +85 -0
  198. pytensor/link/numba/dispatch/linalg/solvers/hermitian.py +136 -0
  199. pytensor/link/numba/dispatch/linalg/solvers/linear_control.py +98 -0
  200. pytensor/link/numba/dispatch/linalg/solvers/lu_solve.py +134 -0
  201. pytensor/link/numba/dispatch/linalg/solvers/posdef.py +110 -0
  202. pytensor/link/numba/dispatch/linalg/solvers/symmetric.py +134 -0
  203. pytensor/link/numba/dispatch/linalg/solvers/triangular.py +132 -0
  204. pytensor/link/numba/dispatch/linalg/solvers/tridiagonal.py +368 -0
  205. pytensor/link/numba/dispatch/linalg/solvers/utils.py +11 -0
  206. pytensor/link/numba/dispatch/linalg/summary.py +46 -0
  207. pytensor/link/numba/dispatch/linalg/utils.py +133 -0
  208. pytensor/link/numba/dispatch/optimize/__init__.py +2 -0
  209. pytensor/link/numba/dispatch/optimize/scalar_minimize.py +489 -0
  210. pytensor/link/numba/dispatch/optimize/scalar_root.py +652 -0
  211. pytensor/link/numba/dispatch/optimize/utils.py +48 -0
  212. pytensor/link/numba/dispatch/random.py +518 -0
  213. pytensor/link/numba/dispatch/scalar.py +655 -0
  214. pytensor/link/numba/dispatch/scan.py +457 -0
  215. pytensor/link/numba/dispatch/shape.py +78 -0
  216. pytensor/link/numba/dispatch/signal/__init__.py +1 -0
  217. pytensor/link/numba/dispatch/signal/conv.py +125 -0
  218. pytensor/link/numba/dispatch/sort.py +65 -0
  219. pytensor/link/numba/dispatch/sparse/__init__.py +1 -0
  220. pytensor/link/numba/dispatch/sparse/basic.py +914 -0
  221. pytensor/link/numba/dispatch/sparse/math.py +1367 -0
  222. pytensor/link/numba/dispatch/sparse/variable.py +651 -0
  223. pytensor/link/numba/dispatch/string_codegen.py +31 -0
  224. pytensor/link/numba/dispatch/subtensor.py +887 -0
  225. pytensor/link/numba/dispatch/tensor_basic.py +501 -0
  226. pytensor/link/numba/dispatch/typed_list.py +251 -0
  227. pytensor/link/numba/dispatch/vectorize_codegen.py +1519 -0
  228. pytensor/link/numba/linker.py +32 -0
  229. pytensor/link/pytorch/dispatch/__init__.py +15 -0
  230. pytensor/link/pytorch/dispatch/basic.py +226 -0
  231. pytensor/link/pytorch/dispatch/blas.py +14 -0
  232. pytensor/link/pytorch/dispatch/blockwise.py +32 -0
  233. pytensor/link/pytorch/dispatch/elemwise.py +231 -0
  234. pytensor/link/pytorch/dispatch/extra_ops.py +53 -0
  235. pytensor/link/pytorch/dispatch/linalg/__init__.py +6 -0
  236. pytensor/link/pytorch/dispatch/linalg/decomposition.py +77 -0
  237. pytensor/link/pytorch/dispatch/linalg/inverse.py +22 -0
  238. pytensor/link/pytorch/dispatch/linalg/products.py +12 -0
  239. pytensor/link/pytorch/dispatch/linalg/summary.py +20 -0
  240. pytensor/link/pytorch/dispatch/math.py +14 -0
  241. pytensor/link/pytorch/dispatch/scalar.py +115 -0
  242. pytensor/link/pytorch/dispatch/shape.py +58 -0
  243. pytensor/link/pytorch/dispatch/sort.py +27 -0
  244. pytensor/link/pytorch/dispatch/subtensor.py +134 -0
  245. pytensor/link/pytorch/linker.py +104 -0
  246. pytensor/link/utils.py +949 -0
  247. pytensor/link/vm.py +1335 -0
  248. pytensor/misc/__init__.py +0 -0
  249. pytensor/misc/check_blas.py +300 -0
  250. pytensor/misc/check_blas_many.sh +21 -0
  251. pytensor/misc/check_duplicate_key.py +71 -0
  252. pytensor/misc/elemwise_openmp_speedup.py +77 -0
  253. pytensor/misc/elemwise_time_test.py +76 -0
  254. pytensor/misc/frozendict.py +44 -0
  255. pytensor/misc/may_share_memory.py +38 -0
  256. pytensor/misc/ordered_set.py +44 -0
  257. pytensor/misc/pkl_utils.py +64 -0
  258. pytensor/npy_2_compat.py +22 -0
  259. pytensor/printing.py +2731 -0
  260. pytensor/py.typed +0 -0
  261. pytensor/raise_op.py +203 -0
  262. pytensor/scalar/__init__.py +2 -0
  263. pytensor/scalar/basic.py +4357 -0
  264. pytensor/scalar/c_code/Faddeeva.cc +2517 -0
  265. pytensor/scalar/c_code/Faddeeva.hh +62 -0
  266. pytensor/scalar/c_code/gamma.c +375 -0
  267. pytensor/scalar/c_code/incbet.c +313 -0
  268. pytensor/scalar/loop.py +328 -0
  269. pytensor/scalar/math.py +1913 -0
  270. pytensor/scalar/sharedvar.py +61 -0
  271. pytensor/scan/__init__.py +57 -0
  272. pytensor/scan/basic.py +1192 -0
  273. pytensor/scan/checkpoints.py +191 -0
  274. pytensor/scan/op.py +3633 -0
  275. pytensor/scan/rewriting/__init__.py +30 -0
  276. pytensor/scan/rewriting/constant_folding.py +63 -0
  277. pytensor/scan/rewriting/db.py +283 -0
  278. pytensor/scan/rewriting/inner_graph.py +319 -0
  279. pytensor/scan/rewriting/inplace.py +197 -0
  280. pytensor/scan/rewriting/io.py +306 -0
  281. pytensor/scan/rewriting/merge.py +562 -0
  282. pytensor/scan/rewriting/push_out.py +986 -0
  283. pytensor/scan/rewriting/trace.py +1080 -0
  284. pytensor/scan/rewriting/utils.py +151 -0
  285. pytensor/scan/scan_perform.c +40260 -0
  286. pytensor/scan/scan_perform.cp315-win_amd64.pyd +0 -0
  287. pytensor/scan/scan_perform.pyx +603 -0
  288. pytensor/scan/scan_perform_ext.py +17 -0
  289. pytensor/scan/utils.py +909 -0
  290. pytensor/scan/views.py +260 -0
  291. pytensor/sparse/__init__.py +5 -0
  292. pytensor/sparse/basic.py +1919 -0
  293. pytensor/sparse/linalg.py +96 -0
  294. pytensor/sparse/math.py +2151 -0
  295. pytensor/sparse/rewriting.py +2057 -0
  296. pytensor/sparse/sharedvar.py +30 -0
  297. pytensor/sparse/type.py +253 -0
  298. pytensor/sparse/utils.py +20 -0
  299. pytensor/sparse/variable.py +481 -0
  300. pytensor/tensor/__init__.py +162 -0
  301. pytensor/tensor/basic.py +4514 -0
  302. pytensor/tensor/blas/__init__.py +145 -0
  303. pytensor/tensor/blas/_core.py +189 -0
  304. pytensor/tensor/blas/batched.py +278 -0
  305. pytensor/tensor/blas/blas_c.py +110 -0
  306. pytensor/tensor/blas/c_code/__init__.py +0 -0
  307. pytensor/tensor/blas/c_code/alt_blas_common.h +21 -0
  308. pytensor/tensor/blas/c_code/alt_blas_template.c +369 -0
  309. pytensor/tensor/blas/c_code/blas_headers.py +1210 -0
  310. pytensor/tensor/blas/c_code/codegen.py +888 -0
  311. pytensor/tensor/blas/gemm.py +362 -0
  312. pytensor/tensor/blas/gemv.py +117 -0
  313. pytensor/tensor/blockwise.py +635 -0
  314. pytensor/tensor/einsum.py +818 -0
  315. pytensor/tensor/elemwise.py +1839 -0
  316. pytensor/tensor/elemwise_cgen.py +761 -0
  317. pytensor/tensor/exceptions.py +16 -0
  318. pytensor/tensor/extra_ops.py +1975 -0
  319. pytensor/tensor/fft.py +222 -0
  320. pytensor/tensor/fourier.py +188 -0
  321. pytensor/tensor/functional.py +131 -0
  322. pytensor/tensor/interpolate.py +200 -0
  323. pytensor/tensor/linalg/__init__.py +134 -0
  324. pytensor/tensor/linalg/_lazy.py +12 -0
  325. pytensor/tensor/linalg/constructors.py +121 -0
  326. pytensor/tensor/linalg/decomposition/__init__.py +1 -0
  327. pytensor/tensor/linalg/decomposition/cholesky.py +198 -0
  328. pytensor/tensor/linalg/decomposition/eigen.py +516 -0
  329. pytensor/tensor/linalg/decomposition/lu.py +347 -0
  330. pytensor/tensor/linalg/decomposition/qr.py +383 -0
  331. pytensor/tensor/linalg/decomposition/schur.py +607 -0
  332. pytensor/tensor/linalg/decomposition/svd.py +244 -0
  333. pytensor/tensor/linalg/dtype_utils.py +42 -0
  334. pytensor/tensor/linalg/inverse.py +218 -0
  335. pytensor/tensor/linalg/products.py +302 -0
  336. pytensor/tensor/linalg/solvers/__init__.py +0 -0
  337. pytensor/tensor/linalg/solvers/core.py +126 -0
  338. pytensor/tensor/linalg/solvers/general.py +269 -0
  339. pytensor/tensor/linalg/solvers/linear_control.py +462 -0
  340. pytensor/tensor/linalg/solvers/lstsq.py +98 -0
  341. pytensor/tensor/linalg/solvers/psd.py +108 -0
  342. pytensor/tensor/linalg/solvers/triangular.py +142 -0
  343. pytensor/tensor/linalg/solvers/tridiagonal.py +227 -0
  344. pytensor/tensor/linalg/summary.py +344 -0
  345. pytensor/tensor/math.py +4397 -0
  346. pytensor/tensor/nlinalg.py +58 -0
  347. pytensor/tensor/optimize.py +1370 -0
  348. pytensor/tensor/pad.py +686 -0
  349. pytensor/tensor/random/__init__.py +7 -0
  350. pytensor/tensor/random/basic.py +2179 -0
  351. pytensor/tensor/random/op.py +543 -0
  352. pytensor/tensor/random/rewriting/__init__.py +11 -0
  353. pytensor/tensor/random/rewriting/basic.py +385 -0
  354. pytensor/tensor/random/rewriting/jax.py +196 -0
  355. pytensor/tensor/random/rewriting/numba.py +192 -0
  356. pytensor/tensor/random/type.py +175 -0
  357. pytensor/tensor/random/utils.py +352 -0
  358. pytensor/tensor/random/variable.py +252 -0
  359. pytensor/tensor/reshape.py +528 -0
  360. pytensor/tensor/rewriting/__init__.py +22 -0
  361. pytensor/tensor/rewriting/assumptions.py +65 -0
  362. pytensor/tensor/rewriting/basic.py +1630 -0
  363. pytensor/tensor/rewriting/blas.py +885 -0
  364. pytensor/tensor/rewriting/blas_c.py +52 -0
  365. pytensor/tensor/rewriting/blockwise.py +372 -0
  366. pytensor/tensor/rewriting/einsum.py +53 -0
  367. pytensor/tensor/rewriting/elemwise.py +1221 -0
  368. pytensor/tensor/rewriting/extra_ops.py +119 -0
  369. pytensor/tensor/rewriting/fused_elemwise.py +955 -0
  370. pytensor/tensor/rewriting/inplace.py +352 -0
  371. pytensor/tensor/rewriting/jax.py +201 -0
  372. pytensor/tensor/rewriting/linalg/__init__.py +12 -0
  373. pytensor/tensor/rewriting/linalg/decomposition.py +732 -0
  374. pytensor/tensor/rewriting/linalg/inverse.py +177 -0
  375. pytensor/tensor/rewriting/linalg/products.py +434 -0
  376. pytensor/tensor/rewriting/linalg/reassociate_matmul.py +685 -0
  377. pytensor/tensor/rewriting/linalg/solvers.py +892 -0
  378. pytensor/tensor/rewriting/linalg/summary.py +324 -0
  379. pytensor/tensor/rewriting/linalg/utils.py +181 -0
  380. pytensor/tensor/rewriting/math.py +4232 -0
  381. pytensor/tensor/rewriting/numba.py +120 -0
  382. pytensor/tensor/rewriting/ofg.py +82 -0
  383. pytensor/tensor/rewriting/optimize.py +105 -0
  384. pytensor/tensor/rewriting/reshape.py +72 -0
  385. pytensor/tensor/rewriting/scalarize.py +268 -0
  386. pytensor/tensor/rewriting/shape.py +1041 -0
  387. pytensor/tensor/rewriting/sort.py +98 -0
  388. pytensor/tensor/rewriting/special.py +184 -0
  389. pytensor/tensor/rewriting/subtensor.py +3199 -0
  390. pytensor/tensor/rewriting/subtensor_lift.py +1567 -0
  391. pytensor/tensor/rewriting/uncanonicalize.py +232 -0
  392. pytensor/tensor/shape.py +1007 -0
  393. pytensor/tensor/sharedvar.py +137 -0
  394. pytensor/tensor/signal/__init__.py +4 -0
  395. pytensor/tensor/signal/conv.py +348 -0
  396. pytensor/tensor/slinalg.py +65 -0
  397. pytensor/tensor/sort.py +213 -0
  398. pytensor/tensor/special.py +341 -0
  399. pytensor/tensor/subtensor.py +3058 -0
  400. pytensor/tensor/symbolic.py +45 -0
  401. pytensor/tensor/type.py +1416 -0
  402. pytensor/tensor/type_other.py +143 -0
  403. pytensor/tensor/utils.py +307 -0
  404. pytensor/tensor/var.py +11 -0
  405. pytensor/tensor/variable.py +1122 -0
  406. pytensor/tensor/xlogx.py +37 -0
  407. pytensor/typed_list/__init__.py +3 -0
  408. pytensor/typed_list/basic.py +663 -0
  409. pytensor/typed_list/rewriting.py +26 -0
  410. pytensor/typed_list/type.py +141 -0
  411. pytensor/utils.py +426 -0
  412. pytensor/xtensor/__init__.py +9 -0
  413. pytensor/xtensor/basic.py +153 -0
  414. pytensor/xtensor/indexing.py +265 -0
  415. pytensor/xtensor/linalg.py +102 -0
  416. pytensor/xtensor/math.py +653 -0
  417. pytensor/xtensor/random/__init__.py +2 -0
  418. pytensor/xtensor/random/basic.py +254 -0
  419. pytensor/xtensor/random/type.py +88 -0
  420. pytensor/xtensor/random/variable.py +204 -0
  421. pytensor/xtensor/reduction.py +136 -0
  422. pytensor/xtensor/rewriting/__init__.py +6 -0
  423. pytensor/xtensor/rewriting/basic.py +87 -0
  424. pytensor/xtensor/rewriting/indexing.py +213 -0
  425. pytensor/xtensor/rewriting/math.py +47 -0
  426. pytensor/xtensor/rewriting/reduction.py +72 -0
  427. pytensor/xtensor/rewriting/shape.py +197 -0
  428. pytensor/xtensor/rewriting/utils.py +71 -0
  429. pytensor/xtensor/rewriting/vectorization.py +114 -0
  430. pytensor/xtensor/shape.py +707 -0
  431. pytensor/xtensor/signal.py +74 -0
  432. pytensor/xtensor/type.py +1143 -0
  433. pytensor/xtensor/vectorization.py +686 -0
  434. pytensor-3.4.0.dist-info/METADATA +208 -0
  435. pytensor-3.4.0.dist-info/RECORD +439 -0
  436. pytensor-3.4.0.dist-info/WHEEL +5 -0
  437. pytensor-3.4.0.dist-info/entry_points.txt +2 -0
  438. pytensor-3.4.0.dist-info/licenses/LICENSE.txt +41 -0
  439. pytensor-3.4.0.dist-info/top_level.txt +1 -0
pytensor/__init__.py ADDED
@@ -0,0 +1,61 @@
1
+ import sys
2
+
3
+
4
+ __docformat__ = "restructuredtext en"
5
+
6
+
7
+ from pytensor import _version
8
+
9
+
10
+ __version__: str = _version.get_versions()["version"]
11
+
12
+ del _version
13
+
14
+
15
+ from pytensor.configdefaults import config
16
+
17
+
18
+ # isort: off
19
+ from pytensor import tensor
20
+ from pytensor.compile import (
21
+ In,
22
+ Mode,
23
+ Out,
24
+ shared,
25
+ wrap_py,
26
+ )
27
+ from pytensor.compile.maker import function
28
+ from pytensor.compile.mode import get_mode
29
+ from pytensor.gradient import Lop, Rop, grad, pullback, pushforward
30
+ from pytensor.printing import debugprint as dprint
31
+
32
+ # Preload the deprecated module before binding the helper with the same name.
33
+ import pytensor.ifelse
34
+ from pytensor.conditional import ifelse
35
+ from pytensor.scan.basic import scan
36
+ from pytensor.scan.views import map
37
+ from pytensor.compile.builders import OpFromGraph
38
+ import pytensor.compile.rewriting # register OpFromGraph rewrites in optdb
39
+ from pytensor.link.jax.ops import wrap_jax
40
+ from pytensor import _sparse_lazy
41
+ # isort: on
42
+
43
+
44
+ def __getattr__(name):
45
+ if name == "sparse":
46
+ # During pytensor.sparse's own import, submodules may do
47
+ # `import pytensor.sparse.X as Y` which probes pytensor.sparse via
48
+ # getattr before the parent attribute has been set. Return the
49
+ # partially-loaded module from sys.modules to avoid re-entry.
50
+ if "pytensor.sparse" in sys.modules:
51
+ return sys.modules["pytensor.sparse"]
52
+ import pytensor.sparse as sparse
53
+
54
+ return sparse
55
+ raise AttributeError(f"module 'pytensor' has no attribute {name!r}")
56
+
57
+
58
+ # Some config variables are registered by submodules. Only after all those
59
+ # imports were executed, we can warn about remaining flags provided by the user
60
+ # through PYTENSOR_FLAGS.
61
+ config.warn_unused_flags()
@@ -0,0 +1,31 @@
1
+ """Lazy registration of scipy.sparse handlers on pytensor's dispatchers.
2
+
3
+ Imported by `pytensor/__init__.py` so `pytensor.sparse` doesn't have to be
4
+ loaded eagerly at startup. The fallbacks match `type(x).__module__` against
5
+ `scipy.sparse` as a string, so this module itself doesn't import scipy.sparse;
6
+ the real handlers (and their scipy.sparse dependency) are pulled in only when
7
+ an actual scipy.sparse value is passed to `as_symbolic` / `shared`.
8
+ """
9
+
10
+ from pytensor.basic import _as_symbolic
11
+ from pytensor.compile.sharedvalue import shared_constructor
12
+
13
+
14
+ def _lazy_as_symbolic_sparse(x):
15
+ if type(x).__module__.startswith("scipy.sparse"):
16
+ from pytensor.sparse.basic import as_symbolic_sparse
17
+
18
+ return as_symbolic_sparse
19
+ return None
20
+
21
+
22
+ def _lazy_shared_sparse(x):
23
+ if type(x).__module__.startswith("scipy.sparse"):
24
+ from pytensor.sparse.sharedvar import sparse_constructor
25
+
26
+ return sparse_constructor
27
+ return None
28
+
29
+
30
+ _as_symbolic.register_lazy(_lazy_as_symbolic_sparse) # type: ignore[attr-defined]
31
+ shared_constructor.register_lazy(_lazy_shared_sparse) # type: ignore[attr-defined]
pytensor/_version.py ADDED
@@ -0,0 +1,21 @@
1
+
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
+ # revision-control system data, or from the parent directory name of an
4
+ # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
+ # of this file.
6
+
7
+ import json
8
+
9
+ version_json = '''
10
+ {
11
+ "date": "2026-11-30T16:14:14+0100",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "967cd9e9d9a27e0e2d9fcc2b1d51a83ab8ffc68e",
15
+ "version": "3.4.0"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
@@ -0,0 +1,108 @@
1
+ # Import every rule module so its registrations land on the global registry that
2
+ # ``check_assumption`` consults. The property modules pull in the shared helper
3
+ # modules (alloc, dimshuffle, subtensor, dot, elemwise) transitively.
4
+ import pytensor.assumptions.alloc
5
+ import pytensor.assumptions.blockwise
6
+ import pytensor.assumptions.diagonal
7
+ import pytensor.assumptions.dimshuffle
8
+ import pytensor.assumptions.orthogonal
9
+ import pytensor.assumptions.permutation
10
+ import pytensor.assumptions.positive_definite
11
+ import pytensor.assumptions.reshape
12
+ import pytensor.assumptions.selection
13
+ import pytensor.assumptions.shape
14
+ import pytensor.assumptions.subtensor
15
+ import pytensor.assumptions.symmetric
16
+ import pytensor.assumptions.triangular
17
+ import pytensor.assumptions.tridiagonal
18
+ import pytensor.assumptions.unit_magnitude
19
+ from pytensor.assumptions.bundles import register_matrix_property_rules
20
+ from pytensor.assumptions.core import (
21
+ ALL_KEYS,
22
+ DIAGONAL,
23
+ IMPLIES,
24
+ KEY_REGISTRY,
25
+ LOWER_TRIANGULAR,
26
+ MATRIX_KEYS,
27
+ ORTHOGONAL,
28
+ PERMUTATION,
29
+ POSITIVE_DEFINITE,
30
+ SELECTION,
31
+ SYMMETRIC,
32
+ TRIDIAGONAL,
33
+ UNIQUE_INDICES,
34
+ UNIT_MAGNITUDE,
35
+ UPPER_TRIANGULAR,
36
+ AssumptionFeature,
37
+ AssumptionKey,
38
+ ConflictingAssumptionsError,
39
+ FactState,
40
+ check_assumption,
41
+ implication_holds,
42
+ register_assumption,
43
+ register_constant_inference,
44
+ register_implies,
45
+ register_type_inference,
46
+ register_universal_assumption,
47
+ )
48
+ from pytensor.assumptions.specify import (
49
+ SpecifyAssumptions,
50
+ assume,
51
+ specify_assumption_rule,
52
+ )
53
+ from pytensor.graph.fg import FunctionGraph
54
+
55
+
56
+ def summarize_assumptions(feature: AssumptionFeature, var) -> str:
57
+ """Return a compact ``{...}`` tag of the facts known about *var*.
58
+
59
+ Each TRUE fact appears as its ``short_name``; each FALSE fact as ``!short_name``.
60
+ Implied facts are pruned: a TRUE fact is dropped when a stronger fact (one that
61
+ implies it) is also TRUE, and a FALSE fact is dropped when a weaker fact (one it
62
+ implies) is also FALSE. Return ``""`` when nothing is known.
63
+ """
64
+ states = {}
65
+ for key in ALL_KEYS:
66
+ try:
67
+ states[key] = feature.get(var, key)
68
+ except ConflictingAssumptionsError:
69
+ states[key] = FactState.CONFLICT
70
+
71
+ tokens = []
72
+ for key in ALL_KEYS:
73
+ state = states[key]
74
+ label = key.short_name or key.name
75
+ if state is FactState.TRUE:
76
+ if any(
77
+ key in weaker
78
+ and implication_holds(var, stronger, key)
79
+ and states[stronger] is FactState.TRUE
80
+ for stronger, weaker in IMPLIES.items()
81
+ ):
82
+ continue
83
+ tokens.append(label)
84
+ elif state is FactState.FALSE:
85
+ if any(
86
+ implication_holds(var, key, w) and states[w] is FactState.FALSE
87
+ for w in IMPLIES.get(key, ())
88
+ ):
89
+ continue
90
+ tokens.append(f"!{label}")
91
+ elif state is FactState.CONFLICT:
92
+ tokens.append(f"{label}=CONFLICT")
93
+
94
+ return "{" + ", ".join(tokens) + "}" if tokens else ""
95
+
96
+
97
+ def assumption_tags(outputs) -> dict:
98
+ """Map each variable reachable from *outputs* to its :func:`summarize_assumptions`
99
+ tag, omitting variables with no known facts."""
100
+ fgraph = FunctionGraph(outputs=list(outputs), clone=False)
101
+ feature = AssumptionFeature()
102
+ fgraph.attach_feature(feature)
103
+ tags = {}
104
+ for var in fgraph.variables:
105
+ tag = summarize_assumptions(feature, var)
106
+ if tag:
107
+ tags[var] = tag
108
+ return tags
@@ -0,0 +1,181 @@
1
+ from functools import wraps
2
+
3
+ import numpy as np
4
+
5
+ from pytensor.assumptions.core import (
6
+ MATRIX_KEYS,
7
+ FactState,
8
+ register_assumption,
9
+ true_if,
10
+ )
11
+ from pytensor.tensor.basic import (
12
+ Alloc,
13
+ NotScalarConstantError,
14
+ get_underlying_scalar_constant_value,
15
+ )
16
+ from pytensor.tensor.blockwise import Blockwise
17
+ from pytensor.tensor.variable import TensorConstant
18
+
19
+
20
+ def alloc_has_zero_off_diagonal(
21
+ key, op, feature, fgraph, node, input_states
22
+ ) -> list[FactState]:
23
+ """``Alloc`` rule for DIAGONAL / LOWER_TRIANGULAR / UPPER_TRIANGULAR: TRUE when
24
+ the fill value is the scalar 0 (an all-zero square matrix) or the matrix is at
25
+ most 1x1 (no off-diagonal entries), FALSE when it is a known non-zero scalar
26
+ and the matrix is at least 2x2 -- the off-diagonal entries are then non-zero,
27
+ so none of these properties holds.
28
+
29
+ Requires the trailing two output dims to be statically known and equal; these
30
+ properties apply only to square matrices. SYMMETRIC uses :func:`alloc_is_symmetric`
31
+ instead, since a constant fill is symmetric whatever its value.
32
+ """
33
+ out_shape = node.outputs[0].type.shape
34
+ if len(out_shape) < 2:
35
+ return [FactState.UNKNOWN]
36
+ m, n = out_shape[-2], out_shape[-1]
37
+ if m is None or n is None or m != n:
38
+ return [FactState.UNKNOWN]
39
+ if n <= 1:
40
+ return [FactState.TRUE]
41
+ try:
42
+ val = get_underlying_scalar_constant_value(node.inputs[0])
43
+ except NotScalarConstantError:
44
+ return [FactState.UNKNOWN]
45
+ return true_if(val == 0, else_false=True)
46
+
47
+
48
+ def alloc_is_symmetric(key, op, feature, fgraph, node, input_states) -> list[FactState]:
49
+ """``Alloc`` rule for SYMMETRIC: a scalar fill broadcasts one value to every
50
+ entry, so a square output equals its transpose -- whatever the value.
51
+
52
+ A non-scalar fill (e.g. a vector broadcast across rows) is left UNKNOWN.
53
+ """
54
+ out_shape = node.outputs[0].type.shape
55
+ if len(out_shape) < 2:
56
+ return [FactState.UNKNOWN]
57
+ m, n = out_shape[-2], out_shape[-1]
58
+ if m is None or n is None or m != n:
59
+ return [FactState.UNKNOWN]
60
+ return true_if(node.inputs[0].type.ndim == 0)
61
+
62
+
63
+ def eye_is_square(n, m) -> FactState:
64
+ """Static squareness of an :class:`Eye` from its row/column size inputs:
65
+ TRUE when the two sizes are provably equal, FALSE when provably unequal,
66
+ UNKNOWN while either remains symbolic."""
67
+ if n is m:
68
+ return FactState.TRUE
69
+ if isinstance(n, TensorConstant) and isinstance(m, TensorConstant):
70
+ return FactState.TRUE if n.data.item() == m.data.item() else FactState.FALSE
71
+ return FactState.UNKNOWN
72
+
73
+
74
+ def eye_identity_rule(key, op, feature, fgraph, node, input_states) -> list[FactState]:
75
+ """Rule for ORTHOGONAL / PERMUTATION / POSITIVE_DEFINITE: TRUE only when an
76
+ :class:`Eye` is the identity matrix (square with ``k == 0``, or 0x0). Every
77
+ other Eye -- rectangular, off-main, or the all-zero matrix of an off-shape
78
+ band -- lacks all three properties, so it is FALSE once the shape is known
79
+ and UNKNOWN while it is still symbolic.
80
+ """
81
+ n, m, k = node.inputs
82
+ if not isinstance(k, TensorConstant):
83
+ return [FactState.UNKNOWN]
84
+ if k.data.item() == 0:
85
+ return [eye_is_square(n, m)]
86
+ rows, cols = node.outputs[0].type.shape
87
+ if rows is None or cols is None:
88
+ return [FactState.UNKNOWN]
89
+ return true_if(rows == cols == 0, else_false=True)
90
+
91
+
92
+ def eye_band_is_empty(node, k: int) -> FactState:
93
+ """Decide statically whether an :class:`Eye`'s ``k``-th diagonal is empty."""
94
+ rows, cols = node.outputs[0].type.shape
95
+ if rows is None or cols is None:
96
+ return FactState.UNKNOWN
97
+ band_is_empty = rows == 0 or cols == 0 or k <= -rows or k >= cols
98
+ return FactState.TRUE if band_is_empty else FactState.FALSE
99
+
100
+
101
+ def eye_zero_or_identity_rule(
102
+ key, op, feature, fgraph, node, input_states
103
+ ) -> list[FactState]:
104
+ """Rule for SYMMETRIC / DIAGONAL: a square :class:`Eye` has both properties
105
+ when it is the identity (``k == 0``) *or* when the requested off-main band
106
+ ``k`` falls entirely outside the shape, leaving an all-zero matrix. A
107
+ non-square Eye, or a square one whose off-main band intersects the shape, is
108
+ neither symmetric nor diagonal.
109
+ """
110
+ n, m, k = node.inputs
111
+ if not isinstance(k, TensorConstant):
112
+ return [FactState.UNKNOWN]
113
+ square = eye_is_square(n, m)
114
+ if square is FactState.FALSE:
115
+ return [FactState.FALSE]
116
+ offset = k.data.item()
117
+ if offset == 0:
118
+ return [square]
119
+ return [eye_band_is_empty(node, offset)]
120
+
121
+
122
+ def alloc_diag_rule(rule):
123
+ """Restrict an :class:`AllocDiag` rule to diagonals on the trailing two axes."""
124
+
125
+ @wraps(rule)
126
+ def guarded_rule(key, op, feature, fgraph, node, input_states):
127
+ core_out_ndim = node.outputs[0].type.ndim
128
+ if isinstance(node.op, Blockwise):
129
+ core_out_ndim -= node.op.batch_ndim(node)
130
+ if (op.axis1, op.axis2) != (core_out_ndim - 2, core_out_ndim - 1):
131
+ return [FactState.UNKNOWN]
132
+ return rule(key, op, feature, fgraph, node, input_states)
133
+
134
+ return guarded_rule
135
+
136
+
137
+ def alloc_diag_band_is_zero(node) -> FactState:
138
+ """Decide statically whether the vector an :class:`AllocDiag` places is zero."""
139
+ diag = node.inputs[0]
140
+ if 0 in diag.type.shape:
141
+ return FactState.TRUE
142
+ if isinstance(diag, TensorConstant):
143
+ return FactState.FALSE if np.any(diag.data) else FactState.TRUE
144
+ try:
145
+ val = get_underlying_scalar_constant_value(diag)
146
+ except NotScalarConstantError:
147
+ return FactState.UNKNOWN
148
+ if val == 0:
149
+ return FactState.TRUE
150
+ if None in diag.type.shape:
151
+ # A non-zero fill of unknown size may still be empty.
152
+ return FactState.UNKNOWN
153
+ return FactState.FALSE
154
+
155
+
156
+ @alloc_diag_rule
157
+ def alloc_diag_has_zero_off_diagonal(
158
+ key, op, feature, fgraph, node, input_states
159
+ ) -> list[FactState]:
160
+ """Rule for DIAGONAL / SYMMETRIC: TRUE when :class:`AllocDiag` places values on
161
+ the main diagonal or places an all-zero vector, FALSE when it places a vector
162
+ with a non-zero entry on any other diagonal."""
163
+ if op.offset == 0:
164
+ return [FactState.TRUE]
165
+ return [alloc_diag_band_is_zero(node)]
166
+
167
+
168
+ def alloc_propagates_matrix_property(
169
+ key, op, feature, fgraph, node, input_states
170
+ ) -> list[FactState]:
171
+ """``Alloc`` broadcasts a value across new or expanded leading axes. When the
172
+ value is already matrix-shaped with non-broadcastable core axes, the alloc
173
+ cannot touch those axes, so the matrix property carries through unchanged."""
174
+ value = node.inputs[0]
175
+ if value.type.ndim >= 2 and not any(value.type.broadcastable[-2:]):
176
+ return [input_states[0]]
177
+ return [FactState.UNKNOWN]
178
+
179
+
180
+ for _key in MATRIX_KEYS:
181
+ register_assumption(_key, Alloc)(alloc_propagates_matrix_property)
@@ -0,0 +1,13 @@
1
+ from pytensor.assumptions.core import (
2
+ infer_assumption_for_node,
3
+ register_universal_assumption,
4
+ )
5
+ from pytensor.tensor.blockwise import Blockwise
6
+
7
+
8
+ @register_universal_assumption(Blockwise)
9
+ def _blockwise_delegate(key, op, feature, fgraph, node, input_states):
10
+ """Delegate assumption inference to the ``core_op`` of a Blockwise wrapper."""
11
+ return infer_assumption_for_node(
12
+ key, op.core_op, feature, fgraph, node, input_states
13
+ )
@@ -0,0 +1,55 @@
1
+ from pytensor.assumptions.alloc import alloc_propagates_matrix_property
2
+ from pytensor.assumptions.core import AssumptionKey, register_assumption
3
+ from pytensor.assumptions.dimshuffle import dimshuffle_propagates_matrix_property
4
+ from pytensor.assumptions.reshape import (
5
+ join_dims_propagates_matrix_property,
6
+ split_dims_propagates_matrix_property,
7
+ )
8
+ from pytensor.assumptions.shape import (
9
+ reshape_propagates_matrix_property,
10
+ specify_shape_propagates_matrix_property,
11
+ )
12
+ from pytensor.assumptions.subtensor import (
13
+ incsubtensor_propagates_matrix_property,
14
+ subtensor_propagates_matrix_property,
15
+ )
16
+ from pytensor.tensor.basic import Alloc
17
+ from pytensor.tensor.elemwise import DimShuffle
18
+ from pytensor.tensor.reshape import JoinDims, SplitDims
19
+ from pytensor.tensor.shape import Reshape, SpecifyShape
20
+ from pytensor.tensor.subtensor import IncSubtensor, Subtensor
21
+
22
+
23
+ def register_matrix_property_rules(key: AssumptionKey) -> None:
24
+ """Register the standard propagation rules for a property of the trailing two axes.
25
+
26
+ Every rule here answers one question: does the Op leave the trailing two axes
27
+ undisturbed? The bundle thus suits any property of a matrix that batch dimensions
28
+ carry elementwise, such as triangularity or a fixed sparsity pattern.
29
+
30
+ Rules are tried in registration order until one returns a non-UNKNOWN state, so a
31
+ key needing different behavior for one Op registers its own with
32
+ ``register_assumption(..., prepend=True)``.
33
+
34
+ Parameters
35
+ ----------
36
+ key : AssumptionKey
37
+ The property to install the rules for.
38
+
39
+ Examples
40
+ --------
41
+ .. code-block:: python
42
+
43
+ from pytensor.assumptions import AssumptionKey, register_matrix_property_rules
44
+
45
+ TOEPLITZ = AssumptionKey("toeplitz", short_name="toep")
46
+ register_matrix_property_rules(TOEPLITZ)
47
+ """
48
+ register_assumption(key, DimShuffle)(dimshuffle_propagates_matrix_property)
49
+ register_assumption(key, Reshape)(reshape_propagates_matrix_property)
50
+ register_assumption(key, SpecifyShape)(specify_shape_propagates_matrix_property)
51
+ register_assumption(key, JoinDims)(join_dims_propagates_matrix_property)
52
+ register_assumption(key, SplitDims)(split_dims_propagates_matrix_property)
53
+ register_assumption(key, Alloc)(alloc_propagates_matrix_property)
54
+ register_assumption(key, Subtensor)(subtensor_propagates_matrix_property)
55
+ register_assumption(key, IncSubtensor)(incsubtensor_propagates_matrix_property)