Skip to content

Commit bbe501c

Browse files
committed
manual curation of docs to eliminate 90% of warnings
1 parent af27934 commit bbe501c

File tree

22 files changed

+53
-71
lines changed

22 files changed

+53
-71
lines changed

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113

114114
# html4_writer added to Fix colon & whitespace misalignment
115115
# https://github.com/readthedocs/sphinx_rtd_theme/issues/766#issuecomment-513852197
116-
html4_writer = True
116+
# https://github.com/readthedocs/sphinx_rtd_theme/issues/766#issuecomment-629666319
117+
# html4_writer = False
117118

118119
html_logo = "images/pytensor_logo.svg"
119120
html_theme = "pymc_sphinx_theme"

doc/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99
- numpy
1010
- scipy
1111
- six
12-
- sphinx>=3
12+
- sphinx>=5.1.0
1313
- mock
1414
- pillow
1515
- pip

doc/extending/type.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ For certain mechanisms, you can register functions and other such
324324
things to plus your type into pytensor's mechanisms. These are optional
325325
but will allow people to use you type with familiar interfaces.
326326

327-
`transfer`
328-
~~~~~~~~~~
327+
**`transfer`**
328+
329329

330330
To plug in additional options for the transfer target, define a
331331
function which takes an PyTensor variable and a target argument and

doc/extending/using_params.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ attribute :attr:`params_type` to an instance of your params Type.
7676
If you want to have multiple parameters, PyTensor provides the convenient class
7777
:class:`pytensor.link.c.params_type.ParamsType` that allows to bundle many parameters into
7878
one object that will be available in both Python (as a Python object) and C code (as a struct).
79-
See :ref:`ParamsType tutorial and API documentation <libdoc_graph_params_type>` for more infos.
8079

8180
For example if we decide to use an int as the params the following
8281
would be appropriate:

doc/library/compile/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
.. _function_inputs:
88

9-
===========================================
9+
============================================
1010
:mod:`io` - defines pytensor.function [TODO]
11-
===========================================
11+
============================================
1212

1313
.. module:: pytensor.compile.io
1414
:platform: Unix, Windows

doc/library/compile/opfromgraph.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.. _opfromgraph:
44

5-
============
5+
=============
66
`OpFromGraph`
7-
============
7+
=============
88

99
This page describes :class:`pytensor.compile.builders.OpFromGraph
1010
<pytensor.compile.builders.OpFromGraph>`, an `Op` constructor that allows one to

doc/library/graph/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@
1818
features
1919
op
2020
type
21-
params_type
2221
utils

doc/library/graph/params_type.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

doc/library/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Modules
1919
config
2020
d3viz/index
2121
graph/index
22-
gpuarray/index
2322
gradient
2423
misc/pkl_utils
2524
printing

doc/library/sandbox/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@
1414
:maxdepth: 1
1515

1616
linalg
17-
neighbours

doc/library/tensor/basic.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ them perfectly, but a `dscalar` otherwise.
557557
.. method:: astype(dtype)
558558
.. method:: take(indices, axis=None, mode='raise')
559559
.. method:: copy()
560+
:noindex:
560561

561562
Return a new symbolic variable that is a copy of the variable. Does not copy the tag.
562563

@@ -620,7 +621,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
620621

621622
Reshape `x` by left padding the shape with `n_ones` 1s. Note that all
622623
this new dimension will be broadcastable. To make them non-broadcastable
623-
see the :func:`unbroadcast`.
624+
see the :func:`specify_shape`.
624625

625626
:param x: variable to be reshaped
626627
:type x: any `TensorVariable` (or compatible)
@@ -634,7 +635,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
634635

635636
Reshape `x` by right padding the shape with `n_ones` ones. Note that all
636637
this new dimension will be broadcastable. To make them non-broadcastable
637-
see the :func:`unbroadcast`.
638+
see the :func:`specify_shape`.
638639

639640
:param x: variable to be reshaped
640641
:type x: any TensorVariable (or compatible)
@@ -647,7 +648,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
647648

648649
Reshape `t` by inserting ``1`` at the dimension `axis`. Note that this new
649650
dimension will be broadcastable. To make it non-broadcastable
650-
see the :func:`unbroadcast`.
651+
see the :func:`specify_shape`.
651652

652653
:type x: any `TensorVariable` (or compatible)
653654
:param x: variable to be reshaped
@@ -667,11 +668,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
667668
>>> pytensor.tensor.shape_padaxis(tensor, axis=-1)
668669
InplaceDimShuffle{0,1,2,x}.0
669670

670-
.. autofunction:: unbroadcast(x, *axes)
671-
672-
.. autofunction:: addbroadcast(x, *axes)
673-
674-
.. autofunction:: patternbroadcast(x, broadcastable)
671+
.. autofunction:: specify_shape(x, shape)
675672

676673
.. function:: flatten(x, ndim=1)
677674

doc/sandbox/sparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Misc
120120
The sparse equivalent of `dmatrix` is `csc_matrix` and `csr_matrix`.
121121

122122
:class:`~pytensor.sparse.basic.Dot` vs. :class:`~pytensor.sparse.basic.StructuredDot`
123-
---------------------------------------------------------------------------------
123+
-------------------------------------------------------------------------------------
124124

125125
Often when you use a sparse matrix it is because there is a meaning to the
126126
structure of non-zeros. The gradient on terms outside that structure

doc/troubleshooting.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Here are Linux troubleshooting instructions. There is a specific `MacOS`_ sectio
1616
.. _network_error_proxy:
1717

1818
Why do I get a network error when I install PyTensor
19-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

2121
If you are behind a proxy, you must do some extra configuration steps
2222
before starting the installation. You must set the environment
@@ -69,7 +69,7 @@ large enough.
6969
.. _float64_output:
7070

7171
pytensor.function returns a float64 when the inputs are float32 and int{32, 64}
72-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7373

7474
It should be noted that using float32 and int{32, 64} together
7575
inside a function would provide float64 as output.
@@ -80,7 +80,7 @@ To help you find where float64 are created, see the
8080
.. _test_pytensor:
8181

8282
How to test that PyTensor works properly
83-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8484

8585
An easy way to check something that could be wrong is by making sure ``PYTENSOR_FLAGS``
8686
have the desired values as well as the ``~/.pytensorrc``

doc/tutorial/profiling.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ of the following two options:
2727
2. Pass the argument :attr:`profile=True` to the function :func:`pytensor.function
2828
<function.function>` and then call :attr:`f.profile.summary()` for a single
2929
function.
30-
- Use this option when you want to profile not all the
31-
functions but only one or more specific function(s).
32-
- You can also combine the profile results of many functions:
30+
31+
- Use this option when you want to profile not all the
32+
functions but only one or more specific function(s).
33+
- You can also combine the profile results of many functions:
3334

3435
.. doctest::
3536
:hide:

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies:
3131
- pytest-cov
3232
- pytest-xdist
3333
# For building docs
34-
- sphinx>=1.3
34+
- sphinx>=5.1.0
3535
- sphinx_rtd_theme
3636
- pygments
3737
- pydot

pytensor/graph/op.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ def grad(
356356
grads
357357
The gradients with respect to each `Variable` in `inputs`.
358358
359+
References
360+
----------
359361
.. [1] Giles, Mike. 2008. “An Extended Collection of Matrix Derivative Results for Forward and Reverse Mode Automatic Differentiation.”
360362
361363
"""

pytensor/graph/rewriting/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def transform(
168168
- ``False`` to indicate that this rewrite cannot be applied to `node`
169169
- A list of `Variable`\s to use in place of the `node`'s current outputs
170170
- A ``dict`` mapping old `Variable`\s to `Variable`\s, or the key
171-
``"remove"`` mapping to a list of `Variable`\s to be removed.
171+
``"remove"`` mapping to a list of `Variable`\s to be removed.
172172
173173
Parameters
174174
----------

pytensor/misc/pkl_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ class StripPickler(Pickler):
4747
Example
4848
-------
4949
50+
..code-block:: python
51+
5052
fn_args = dict(inputs=inputs,
5153
outputs=outputs,
5254
updates=updates)
5355
dest_pkl = 'my_test.pkl'
5456
with open(dest_pkl, 'wb') as f:
5557
strip_pickler = StripPickler(f, protocol=-1)
5658
strip_pickler.dump(fn_args)
57-
5859
"""
5960

6061
def __init__(self, file, protocol=0, extra_tag_to_remove=None):

pytensor/tensor/elemwise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ def construct(symbol):
17581758
)
17591759

17601760
if getattr(symbol, "__doc__"):
1761-
rval.__doc__ = symbol.__doc__ + "\n" + rval.__doc__
1761+
rval.__doc__ = symbol.__doc__ + "\n\n " + rval.__doc__
17621762

17631763
# for the meaning of this see the ./epydoc script
17641764
# it makes epydoc display rval as if it were a function, not an object

pytensor/tensor/math.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,18 +1442,18 @@ def betainc(a, b, x):
14421442

14431443
@scalar_elemwise
14441444
def real(z):
1445-
"""Return real component of complex-valued tensor `z`"""
1445+
"""Return real component of complex-valued tensor `z`."""
14461446

14471447

1448-
_tensor_py_operators.real = property(real)
1448+
_tensor_py_operators.real = property(real, doc=real.__doc__)
14491449

14501450

14511451
@scalar_elemwise
14521452
def imag(z):
1453-
"""Return imaginary component of complex-valued tensor `z`"""
1453+
"""Return imaginary component of complex-valued tensor `z`."""
14541454

14551455

1456-
_tensor_py_operators.imag = property(imag)
1456+
_tensor_py_operators.imag = property(imag, doc=imag.__doc__)
14571457

14581458

14591459
@scalar_elemwise

pytensor/tensor/rewriting/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
r"""Rewrites for the `Op`\s in `pytensor.tensor.math`."""
1+
r"""Rewrites for the `Op`\s in :mod:`pytensor.tensor.math`."""
22

33
import itertools
44
import operator

pytensor/tensor/var.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -654,13 +654,13 @@ def __rdot__(right, left):
654654
__rmatmul__ = __rdot__
655655

656656
def sum(self, axis=None, dtype=None, keepdims=False, acc_dtype=None):
657-
"""See `pytensor.tensor.math.sum`."""
657+
"""See :func:`pytensor.tensor.math.sum`."""
658658
return at.math.sum(
659659
self, axis=axis, dtype=dtype, keepdims=keepdims, acc_dtype=acc_dtype
660660
)
661661

662662
def prod(self, axis=None, dtype=None, keepdims=False, acc_dtype=None):
663-
"""See `pytensor.tensor.math.prod`."""
663+
"""See :func:`pytensor.tensor.math.prod`."""
664664
return at.math.prod(
665665
self, axis=axis, dtype=dtype, keepdims=keepdims, acc_dtype=acc_dtype
666666
)
@@ -681,73 +681,73 @@ def norm(self, L, axis=None, keepdims=False):
681681
return y
682682

683683
def mean(self, axis=None, dtype=None, keepdims=False, acc_dtype=None):
684-
"""See `pytensor.tensor.math.mean`."""
684+
"""See :func:`pytensor.tensor.math.mean`."""
685685
return at.math.mean(
686686
self, axis=axis, dtype=dtype, keepdims=keepdims, acc_dtype=acc_dtype
687687
)
688688

689689
def var(self, axis=None, ddof=0, keepdims=False, corrected=False):
690-
"""See `pytensor.tensor.math.var`."""
690+
"""See :func:`pytensor.tensor.math.var`."""
691691
return at.math.var(
692692
self, axis=axis, ddof=ddof, keepdims=keepdims, corrected=corrected
693693
)
694694

695695
def std(self, axis=None, ddof=0, keepdims=False, corrected=False):
696-
"""See `pytensor.tensor.math.std`."""
696+
"""See :func:`pytensor.tensor.math.std`."""
697697
return at.math.std(
698698
self, axis=axis, ddof=ddof, keepdims=keepdims, corrected=corrected
699699
)
700700

701701
def min(self, axis=None, keepdims=False):
702-
"""See `pytensor.tensor.math.min`."""
702+
"""See :func:`pytensor.tensor.math.min`."""
703703
return at.math.min(self, axis, keepdims=keepdims)
704704

705705
def max(self, axis=None, keepdims=False):
706-
"""See `pytensor.tensor.math.max`."""
706+
"""See :func:`pytensor.tensor.math.max`."""
707707
return at.math.max(self, axis, keepdims=keepdims)
708708

709709
def argmin(self, axis=None, keepdims=False):
710-
"""See `pytensor.tensor.math.argmin`."""
710+
"""See :func:`pytensor.tensor.math.argmin`."""
711711
return at.math.argmin(self, axis, keepdims=keepdims)
712712

713713
def argmax(self, axis=None, keepdims=False):
714-
"""See `pytensor.tensor.math.argmax`."""
714+
"""See :func:`pytensor.tensor.math.argmax`."""
715715
return at.math.argmax(self, axis, keepdims=keepdims)
716716

717717
def nonzero(self, return_matrix=False):
718-
"""See `pytensor.tensor.basic.nonzero`."""
718+
"""See :func:`pytensor.tensor.basic.nonzero`."""
719719
return at.nonzero(self, return_matrix=return_matrix)
720720

721721
def nonzero_values(self):
722-
"""See `pytensor.tensor.basic.nonzero_values`."""
722+
"""See :func:`pytensor.tensor.basic.nonzero_values`."""
723723
return at.nonzero_values(self)
724724

725725
def sort(self, axis=-1, kind="quicksort", order=None):
726-
"""See `pytensor.tensor.sort.sort`."""
726+
"""See :func:`pytensor.tensor.sort.sort`."""
727727
return at.sort(self, axis, kind, order)
728728

729729
def argsort(self, axis=-1, kind="quicksort", order=None):
730-
"""See `pytensor.tensor.sort.argsort`."""
730+
"""See :func:`pytensor.tensor.sort.argsort`."""
731731
from pytensor.tensor.sort import argsort
732732

733733
return argsort(self, axis, kind, order)
734734

735735
def clip(self, a_min, a_max):
736-
"See `pytensor.tensor.math.clip`."
736+
"See :func:`pytensor.tensor.math.clip`."
737737
return at.math.clip(self, a_min, a_max)
738738

739739
def conj(self):
740-
"""See `pytensor.tensor.math.conj`."""
740+
"""See :func:`pytensor.tensor.math.conj`."""
741741
return at.math.conj(self)
742742

743743
conjugate = conj
744744

745745
def repeat(self, repeats, axis=None):
746-
"""See `pytensor.tensor.basic.repeat`."""
746+
"""See :func:`pytensor.tensor.basic.repeat`."""
747747
return at.extra_ops.repeat(self, repeats, axis)
748748

749749
def round(self, mode=None):
750-
"""See `pytensor.tensor.math.round`."""
750+
"""See :func:`pytensor.tensor.math.round`."""
751751
return at.math.round(self, mode)
752752

753753
def trace(self):
@@ -775,12 +775,12 @@ def searchsorted(self, v, side="left", sorter=None):
775775
return at.extra_ops.searchsorted(self, v, side, sorter)
776776

777777
def ptp(self, axis=None):
778-
"""See `pytensor.tensor.math.ptp`."""
778+
"""See :func:`pytensor.tensor.math.ptp`."""
779779

780780
return at.math.ptp(self, axis)
781781

782782
def swapaxes(self, axis1, axis2):
783-
"""See `pytensor.tensor.basic.swapaxes`.
783+
"""See :func:`pytensor.tensor.basic.swapaxes`.
784784
785785
If a matrix is provided with the right axes, its transpose
786786
will be returned.

0 commit comments

Comments
 (0)