Skip to content

Remove deprecated modules #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
39e2ee7
remove deprecated modules from pytensor.graph
ferrine Dec 12, 2022
0a0d00b
clean up pytensor.graph.sched
ferrine Dec 12, 2022
c66d89d
remove MPI
ferrine Dec 13, 2022
112ee6e
remove test sched
ferrine Dec 13, 2022
a585a3c
remove test for deprecated import
ferrine Dec 13, 2022
936b4b8
remove more deprecated modules
ferrine Dec 13, 2022
06ea668
remove deprecated MRG_RandomStream
ferrine Dec 13, 2022
7d17362
remove deprecated pytensor.tensor.nnet
ferrine Dec 13, 2022
26f0d55
remove deprecated module pytensor.assert_op
ferrine Dec 13, 2022
1ad1cd1
remove functions that are not referenced anywhere
ferrine Dec 13, 2022
5a1faa5
remove deprecated config api
ferrine Dec 13, 2022
b272a38
remove pytensor.tensor.signal module as it was marked deprecated
ferrine Dec 14, 2022
1b8ea45
remove ConsiderConstant
ferrine Dec 14, 2022
cad47ee
remove deprecated stack interface
ferrine Dec 14, 2022
091933c
remove deprecated printing api
ferrine Dec 14, 2022
1f2e889
remove outdated deprecations
ferrine Dec 14, 2022
629e0bd
remove deprecated module sparse.opt
ferrine Dec 14, 2022
90ec896
remove deprecated module scan.opt
ferrine Dec 14, 2022
d096c41
remove deprecation exception from scan argumens and replace it with a…
ferrine Dec 14, 2022
b1a1dfc
remove uutdated deprecations from pytensor/tensor/math.py
ferrine Dec 14, 2022
65cd588
remove uutdated deprecations from pytensor/tensor/slinalg.py
ferrine Dec 14, 2022
eca127d
remove outdated deprecations from pytensor/tensor/rewriting/basic.py
ferrine Dec 14, 2022
3e6efb4
remove outdated deprecations from pytensor/graph/rewriting/basic.py
ferrine Dec 14, 2022
0c8e968
remove outdated deprecations from pytensor/graph/rewriting/db.py
ferrine Dec 14, 2022
8de0ed5
remove outdated deprecations from pytensor/graph/rewriting/utils.py
ferrine Dec 14, 2022
9c6653e
remove deprecated module pytensor/tensor/random/opt.py
ferrine Dec 14, 2022
f6ec71b
remove deprecated module pytensor/link/jax/jax_dispatch.py
ferrine Dec 14, 2022
0b92f87
remove deprecated module pytensor/link/jax/jax_linker.py
ferrine Dec 14, 2022
efe448c
remove deprecated pytensoor.change_flags
ferrine Dec 14, 2022
bac999d
remove test for a scipy deprecated submodule
ferrine Dec 14, 2022
b007aca
remove deprecation utility, favor pydeprecate (https://pypi.org/proje…
ferrine Dec 14, 2022
ac2694b
manual curation of docs to eliminate 90% of warnings
ferrine Dec 14, 2022
4c598f8
remove sympy support
ferrine Dec 14, 2022
05a8db2
remove gpu related script pytensor/misc/latence_gpu_transfert.py
ferrine Dec 14, 2022
1aef521
remove unused internal argument
ferrine Dec 14, 2022
a84cee7
remove pytensor/sandbox/solve.py as it is marked deprecated
ferrine Dec 14, 2022
040054a
remove pytensor/sandbox/fourier.py as it is marked deprecated
ferrine Dec 14, 2022
17adb0a
refactor deprecated api
ferrine Dec 14, 2022
393cafd
remove deprecated type from pytensor/sparse/type.py
ferrine Dec 14, 2022
64b356e
bring back deprecated configvals
ferrine Dec 15, 2022
0398c03
remove deleted files from mypy script and improve the structure
ferrine Dec 15, 2022
61a6e4a
remove toposort from pytensor/graph/utils.py it was not referenced an…
ferrine Dec 16, 2022
2c413f3
remove D from pytensor/graph/utils.py it was not referenced anywhere
ferrine Dec 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- "tests/tensor tests/sparse --ignore=tests/tensor/test_basic.py --ignore=tests/tensor/test_math.py --ignore=tests/tensor/test_math_scipy.py --ignore=tests/tensor/test_inplace.py --ignore=tests/tensor/test_elemwise.py --ignore=tests/tensor/rewriting/test_basic.py --ignore=tests/tensor/rewriting/test_math.py --ignore=tests/tensor/nnet --ignore=tests/tensor/signal"
- "tests/tensor/test_basic.py tests/tensor/test_math.py tests/tensor/test_math_scipy.py tests/tensor/test_inplace.py"
- "tests/tensor/test_elemwise.py tests/tensor/rewriting/test_basic.py tests/tensor/rewriting/test_math.py"
- "tests/tensor/nnet/test_conv.py"
- "tests/tensor/conv/test_abstract_conv.py"
include:
- python-version: "3.7"
fast-compile: 1
Expand Down
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@

# html4_writer added to Fix colon & whitespace misalignment
# https://github.com/readthedocs/sphinx_rtd_theme/issues/766#issuecomment-513852197
html4_writer = True
# https://github.com/readthedocs/sphinx_rtd_theme/issues/766#issuecomment-629666319
# html4_writer = False
Comment on lines 114 to +117
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole comment can be removed because the whitespace problem is now taken care of by the pymc-sphinx-theme


html_logo = "images/pytensor_logo.svg"
html_theme = "pymc_sphinx_theme"
Expand Down
2 changes: 1 addition & 1 deletion doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- numpy
- scipy
- six
- sphinx>=3
- sphinx>=5.1.0
- mock
- pillow
- pip
Expand Down
4 changes: 2 additions & 2 deletions doc/extending/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ For certain mechanisms, you can register functions and other such
things to plus your type into pytensor's mechanisms. These are optional
but will allow people to use you type with familiar interfaces.

`transfer`
~~~~~~~~~~
**`transfer`**


To plug in additional options for the transfer target, define a
function which takes an PyTensor variable and a target argument and
Expand Down
1 change: 0 additions & 1 deletion doc/extending/using_params.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ attribute :attr:`params_type` to an instance of your params Type.
If you want to have multiple parameters, PyTensor provides the convenient class
:class:`pytensor.link.c.params_type.ParamsType` that allows to bundle many parameters into
one object that will be available in both Python (as a Python object) and C code (as a struct).
See :ref:`ParamsType tutorial and API documentation <libdoc_graph_params_type>` for more infos.

For example if we decide to use an int as the params the following
would be appropriate:
Expand Down
4 changes: 2 additions & 2 deletions doc/library/compile/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

.. _function_inputs:

===========================================
============================================
:mod:`io` - defines pytensor.function [TODO]
===========================================
============================================

.. module:: pytensor.compile.io
:platform: Unix, Windows
Expand Down
4 changes: 2 additions & 2 deletions doc/library/compile/opfromgraph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

.. _opfromgraph:

============
=============
`OpFromGraph`
============
=============

This page describes :class:`pytensor.compile.builders.OpFromGraph
<pytensor.compile.builders.OpFromGraph>`, an `Op` constructor that allows one to
Expand Down
1 change: 0 additions & 1 deletion doc/library/graph/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
features
op
type
params_type
utils
16 changes: 0 additions & 16 deletions doc/library/graph/params_type.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/library/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Modules
config
d3viz/index
graph/index
gpuarray/index
gradient
misc/pkl_utils
printing
Expand Down
2 changes: 0 additions & 2 deletions doc/library/sandbox/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
:maxdepth: 1

linalg
neighbours
rng_mrg
16 changes: 0 additions & 16 deletions doc/library/sandbox/rng_mrg.rst

This file was deleted.

7 changes: 2 additions & 5 deletions doc/library/tensor/basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ them perfectly, but a `dscalar` otherwise.
.. method:: astype(dtype)
.. method:: take(indices, axis=None, mode='raise')
.. method:: copy()
:noindex:

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

Expand Down Expand Up @@ -667,11 +668,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
>>> pytensor.tensor.shape_padaxis(tensor, axis=-1)
InplaceDimShuffle{0,1,2,x}.0

.. autofunction:: unbroadcast(x, *axes)

.. autofunction:: addbroadcast(x, *axes)

.. autofunction:: patternbroadcast(x, broadcastable)
.. autofunction:: specify_shape(x, shape)

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

Expand Down
11 changes: 11 additions & 0 deletions doc/library/tensor/conv.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=========================================
:mod:`tensor.conv` -- Tensor Convolutions
=========================================

.. module:: tensor.conv
:platform: Unix, Windows
:synopsis: Tensor Convolutions
.. moduleauthor:: LISA, PyMC Developers, PyTensor Developers

.. automodule:: pytensor.tensor.conv
:members:
1 change: 1 addition & 0 deletions doc/library/tensor/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ They are grouped into the following sections:
slinalg
nlinalg
fft
conv
math_opt
basic_opt
5 changes: 0 additions & 5 deletions doc/library/tensor/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ File operation

- Load from disk with the function :func:`load <pytensor.tensor.io.load>` and its associated op :class:`LoadFromDisk <pytensor.tensor.io.LoadFromDisk>`

MPI operation
=============
- Non-blocking transfer: :func:`isend <pytensor.tensor.io.isend>` and :func:`irecv <pytensor.tensor.io.irecv>`.
- Blocking transfer: :func:`send <pytensor.tensor.io.send>` and :func:`recv <pytensor.tensor.io.recv>`

Details
=======

Expand Down
4 changes: 0 additions & 4 deletions doc/library/tensor/slinalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ API

.. automodule:: pytensor.tensor.slinalg
:members:
:exclude-members: solve, solve_lower_triangular, solve_upper_triangular

.. autofunction:: solve(a, b)
.. autofunction:: solve_lower_triangular(a, b)
.. autofunction:: solve_upper_triangular(a, b)
2 changes: 1 addition & 1 deletion doc/sandbox/sparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Misc
The sparse equivalent of `dmatrix` is `csc_matrix` and `csr_matrix`.

:class:`~pytensor.sparse.basic.Dot` vs. :class:`~pytensor.sparse.basic.StructuredDot`
---------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

Often when you use a sparse matrix it is because there is a meaning to the
structure of non-zeros. The gradient on terms outside that structure
Expand Down
6 changes: 3 additions & 3 deletions doc/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Here are Linux troubleshooting instructions. There is a specific `MacOS`_ sectio
.. _network_error_proxy:

Why do I get a network error when I install PyTensor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

pytensor.function returns a float64 when the inputs are float32 and int{32, 64}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

How to test that PyTensor works properly
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

An easy way to check something that could be wrong is by making sure ``PYTENSOR_FLAGS``
have the desired values as well as the ``~/.pytensorrc``
Expand Down
7 changes: 4 additions & 3 deletions doc/tutorial/profiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ of the following two options:
2. Pass the argument :attr:`profile=True` to the function :func:`pytensor.function
<function.function>` and then call :attr:`f.profile.summary()` for a single
function.
- Use this option when you want to profile not all the
functions but only one or more specific function(s).
- You can also combine the profile results of many functions:

- Use this option when you want to profile not all the
functions but only one or more specific function(s).
- You can also combine the profile results of many functions:

.. doctest::
:hide:
Expand Down
5 changes: 3 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
- logical-unification
- miniKanren
- cons
- pydeprecate
# Intel BLAS
- mkl
- mkl-service
Expand All @@ -30,7 +31,7 @@ dependencies:
- pytest-cov
- pytest-xdist
# For building docs
- sphinx>=1.3
- sphinx>=5.1.0
- sphinx_rtd_theme
- pygments
- pydot
Expand All @@ -47,5 +48,5 @@ dependencies:
- packaging
- typing_extensions
# optional
- sympy
- cython

24 changes: 0 additions & 24 deletions pytensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,27 +171,3 @@ def get_scalar_constant_value(v):
# imports were executed, we can warn about remaining flags provided by the user
# through PYTENSOR_FLAGS.
config.warn_unused_flags()

DEPRECATED_NAMES = [
(
"change_flags",
"`pytensor.change_flags` is deprecated: use `pytensor.config.change_flags` instead.",
config.change_flags,
),
]


def __getattr__(name):
"""Intercept module-level attribute access of deprecated symbols.

Adapted from https://stackoverflow.com/a/55139609/3006474.

"""
from warnings import warn

for old_name, msg, old_object in DEPRECATED_NAMES:
if name == old_name:
warn(msg, DeprecationWarning, stacklevel=2)
return old_object

raise AttributeError(f"module {__name__} has no attribute {name}")
11 changes: 0 additions & 11 deletions pytensor/assert_op.py

This file was deleted.

7 changes: 2 additions & 5 deletions pytensor/compile/function/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ def _constructor_Function(maker, input_storage, inputs_data, trust_input=False):
if not config.unpickle_function:
return None

f = maker.create(input_storage, trustme=True)
f = maker.create(input_storage)
assert len(f.input_storage) == len(inputs_data)
for container, x in zip(f.input_storage, inputs_data):
assert (
Expand Down Expand Up @@ -1574,7 +1574,7 @@ def __init__(
for i in self.inputs
]

def create(self, input_storage=None, trustme=False, storage_map=None):
def create(self, input_storage=None, storage_map=None):
"""
Create a function.

Expand All @@ -1584,9 +1584,6 @@ def create(self, input_storage=None, trustme=False, storage_map=None):
A list matching the inputs list and providing default values if the
default for an input is None, then that input is a required input.
For an input with an update, the default acts as initialization.
trustme
Disables some exceptions, used internally.

"""

if input_storage is None:
Expand Down
14 changes: 1 addition & 13 deletions pytensor/compile/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,6 @@ def print_tips(self, file):
from pytensor import scalar as aes
from pytensor.tensor.elemwise import Elemwise
from pytensor.tensor.math import Dot
from pytensor.tensor.random.op import RandomVariable

scalar_op_amdlibm_no_speed_up = [
aes.LT,
Expand Down Expand Up @@ -1628,18 +1627,7 @@ def exp_float32_op(op):
printed_tip = True

# tip 5
for (fgraph, a) in self.apply_time:
node = a
if isinstance(node.op, RandomVariable):
printed_tip = True
print(
" - Replace the default random number generator by "
"'from pytensor.sandbox.rng_mrg import MRG_RandomStream "
"as RandomStream', as this is is faster. It is still "
"experimental, but seems to work correctly.",
file=file,
)
break
# The tip was about MRG_RandomStream which is removed

# tip 6
for (fgraph, a) in self.apply_time:
Expand Down
Loading