Adrian Seyboldt
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # pytensor hackathon planning Goals: - Familiarize as many people as possible with the codebase - Figure out important topics for future work ## Update docs A lot of documentation is using aesara directly, this needs to be changed systematically. ## Rename aesara -> pytensor + [x] Renames of project names in the repository + [ ] `import pytensor.tensor as at` → `import pytensor.tensor as pt` (low-priority) ## Upgrading PyMC + [ ] Bump to Aesara 2.8.9 in PyMC + [ ] Locally test PyMC main with PyTensor main + [ ] If needed, make compatibility changes in PyMC + [ ] Swap PyMC to depend on PyTensor ## Governance & CoC updates + [x] Have been updated to refer to PyMC governance & CoC ## Maintenance setup + [ ] conda-forge feedstock ⏳ https://github.com/conda-forge/staged-recipes/pull/21253 + [x] readthedocs + [x] release automation ## Improve numba backend coverage and testing. Known issues with numba backend: - Compilation is often not tested. - Missing special functions from scipy. Some prior work [here](https://github.com/aesara-devs/aesara/pull/1078). - Missing scipy/numpy linalg functions. - scan performance is sometimes lacking - numba graphs involving random draws? (ie RandomState) - Ricardo: RandomState support is pretty lame. RandomGenerator support seems to be getting better. PR here: https://github.com/aesara-devs/aesara/pull/1245 - Compile time can be long ## Can we remove the c backend? Not currently, the numba backend isn't a full replacement yet, but do we want to do this in the long term? This would simplify distributing aesara a great deal, because we wouldn't have to worry about a compiler in the user environment anymore. Note: C is the most flexible backend, but the hardest to maintain. Max: i think we can at least rewrite c backend in the same dispatch manner as we have for numba or jax. it will bring consistency to the codebase. Same could be done for python backend ## Jax backend Scan is broken: Remi has been working on it in Aesara: https://github.com/aesara-devs/aesara/pull/1202, https://github.com/aesara-devs/aesara/pull/1284 Random graphs are represented completely different in Aesara and JAX, there are some hacks to make it kind of work: https://github.com/aesara-devs/aesara/pull/1214 No windows support ## Merge aeppl back into pymc We decided to move aeppl back into pymc. ## Dynamic or static broadcasting Recently aesara switch to allow dynamic broadcasting. Some background can be found [here](https://github.com/aesara-devs/aesara/discussions/1273). Do we want to support that, and if so, how? We need to deal with issues that were created by that change, either by fixing some current bugs or reverting the original change to allow dynamic broadcasting. (This is a longer topic, needs a separate writeup I think) -> Move back to static shapes, use shape inference for broadcastable info ## Improve static shape inference Currently, there are two different systems in place that figure out shapes of tensors: Static shape inference in the `Op.make_node` methods, and separate infer_shape functions. We probably want to merge those. (This might interact with support for dimensions, as that probably also needs changes to `make_node`) Ricardo: Note: infer_shape always works, it falls-back to executing the Operation and taking the shape if needed. It also returns symbolic expressions, whereas for `make_node` we need concrete values. Constant-folding may be too slow in practice (although if coverage improves, it may not be so bad, because we always have static shapes for the inputs) ## Rewrite safety Theano had lots of unsafe rewrites (ie rewrites that assume that the input of a theano function is valid). There were a lot of changes to change those, so that errors are not optimized away. There are at least a few of those left though, and the dynamic shape changes might have also had an impact on this. It might actually be interesting to change the framework of assumptions of individual ops. Could Asserts be properties of ops or variables, so that they interfere less with rewrites? ## Convert some ops to OpFromGraph Some ops (eg softmax) only need to be custom ops so that we control their gradient. Do we want to convert them to OpFromGraph, so that backends need to implement fewer ops? Ricardo: Yes, but we may want to create an ElemwiseOpFromGraph. Right now OpFromGraph must be compiled with specific input types, which is wasteful. ## Support for dimensions aesara currently only knows about integer shapes, but it would be great if it could make use of dimension information. Do we want to support that? How? Including xarray style broadcasting? Do we want to have ordered dims? Should each dimension have a name? Should that name be unique? ```python country = pt.Dim("country") age = pt.Dim("age") countr_effect = pt.dims.dvector(dims=country) age_effect = pt.dims.dvector(dims=age) effect = country_effect + age_effect # dims=[country, age] # Go from new api to old effect_old_api = effect.to_shaped([country, age]) effect.ravel() # dims={ProductDim({country, age})} effect.rename_dim(country) + effect # dims=(RenamedDim(country), country, age) # Go from old api to new second_dim = pt.Dim() # Do we have to specify a shape? effects_imported = pt.dims.from_shaped(effect_old_api, dims=[county, second_dim]) effects_imported.sum(second_dim) effects.sel(country=["USA", "Italy"]) # dims=(SelDim(country, ["USA", "Italy"]), age) ``` ## (Semi-)Automatic marginalization Ricardo has been experimenting with this. ## Merge Composite Elemwise ops where possible It should often be possible to avoid looping over data several times, if we merge different elemwise ops that use the same inputs. I think this has the potential to speed up a lot logp graphs considerably, especially if combined with the next item. POC implementation (tests still failing) here: https://github.com/aesara-devs/aesara/pull/1242 ```python dist = pm.Normal.dist(mu=np.ones(10), sigma=np.ones(10)) logp = pm.logp(dist, x) grad = pt.grad(logp, x) func = pt.function([x], [logp, grad]) ## we want logp = 0. grad = np.empty_like(x) for i in range(len(x)): dist = -x[i] ** 2 logp -= dist grad[i] = -x # right now y = np.empty_like(x) for i in range(len(x)): y[i] = -val ** 2 logp = sum(y) grad = np.empty_like(x) for i in range(len(x)): grad[i] = -x ``` Need op ElemwiseSum(scalar_op=Composite([in1, in2], [out1, out2]), sum_axes=[False, True]) ## Optimize sum(elemwise) ops We often compute sums of elemwise ops, which is slower than just summing while computing the elemwise. We could do this by introducing a new SumElemwise op, that does both at the same time. Brandon started something here: https://github.com/aesara-devs/aesara/pull/1285 ## review clone_replace / scan these operations are essential to work on pymc and manipulating graph. clone_replace: reading the code i have an inression it is overly complicated and has to be refactored to gain readability and improve overall maintainance. scan: it has some undocumented limitations, strict mode, which if you do not use code can break later without any meaningfull error. scan is essential op. we can improve that subclassing ops into more specific Map/vectorize ops which can be later optimized in other backends i think improving code quality there will bring huge gains as well easy scan things: - improve docs - improve error messages others: - Add specialized scan ops (reduce, elemwise (see blockwise PR in aesara)) - Break up scan into other ops Start adding simpler scan-like ops that only do something simpler. (bottom up) ## Think about a mlir backend See https://mlir.llvm.org/ which also comes with a python interface. ## Think about vmap similar things Blockwise (aesara PR) How does this interact with dims?

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully