Skip to content

Replace at -> pt. #485

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 5 commits into from
Dec 28, 2022
Merged

Replace at -> pt. #485

merged 5 commits into from
Dec 28, 2022

Conversation

twiecki
Copy link
Member

@twiecki twiecki commented Dec 27, 2022

Following #481, now also renaming at->pt. This is the script:

#!/bin/bash

if [ -z "$1" ]
  then
    echo "Script to automatically convert code (*.py and *.ipynb) from PyMC3 to 4.0. Use with care."
    echo "Usage: pymc3_to_4.sh <path>"
    exit 1
fi

declare -a replace_strings=(
    "s/import pytensor\.tensor as at/import pytensor.tensor as pt/g"
     #"s/tt\./pt./g"
     "s/at\./pt./g"
)

for replace in "${replace_strings[@]}"; do
    find $1 -name "*.ipynb" -type f -exec sed -i -e "/png/n;/stat/n;/that/n;$replace" {} \;
done

@twiecki twiecki requested a review from OriolAbril December 27, 2022 17:37
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

" at.as_tensor_variable(emission_noise),\n",
" pt.as_tensor_variable(emission_observed),\n",
" pt.as_tensor_variable(emission_signal),\n",
" pt.as_tensor_variable(emission_noise),\n",
" at.as_tensor_variable(logp_initial_state),\n",
Copy link
Member

Choose a reason for hiding this comment

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

Also this

Copy link
Contributor

@drbenvincent drbenvincent left a comment

Choose a reason for hiding this comment

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

Can probably change (or remove) these lines in rerun.py

"from theano import tensor as tt": "import aesara.tensor as at",
"import theano.tensor as tt": "import aesara.tensor as at",
"theano": "aesara",
"Theano": "Aesara",
"tt.": "at.",
"aet": "at",

@drbenvincent
Copy link
Contributor

There's also this in conf.py

intersphinx_mapping = {
    "aesara": ("https://aesara.readthedocs.io/en/latest/", None),

and this in .pre-commit-config.yaml

      entry: >
          (?x)(arviz-devs.github.io|
               aesara.readthedocs.io|

Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

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

left minor comment, other than that looks good. But I have not gone through the replaces carefully, only skimming

@@ -234,6 +234,7 @@ def setup(app: Sphinx):
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"pymc": ("https://www.pymc.io/projects/docs/en/stable/", None),
"pytensor": ("https://pytensor.readthedocs.io/en/latest/", None),
Copy link
Member

Choose a reason for hiding this comment

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

We should remove aesara from this dict and replace it with pytensor instead of adding pytensor. Same goes for the pre-commit config

@OriolAbril OriolAbril merged commit ff67bea into main Dec 28, 2022
@OriolAbril OriolAbril deleted the at_to_pt branch December 28, 2022 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants