Aesara is a Python library that allows one to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.

Overview

Tests Status Coverage Gitter

logo

Aesara is a Python library that allows one to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.

Features

  • A hackable, pure-Python codebase
  • Extensible graph framework suitable for rapid development of custom operators and symbolic optimizations
  • Implements an extensible graph transpilation framework that currently provides compilation via C, JAX, and Numba
  • Based on one of the most widely-used Python tensor libraries: Theano

Getting started

`1` and the dot product is replaced with a BLAS function # (i.e. CGemv) aesara.dprint(f_d) # Elemwise{Add}[(0, 1)] [id A] '' 5 # |TensorConstant{(1,) of 1.0} [id B] # |CGemv{inplace} [id C] '' 4 # |AllocEmpty{dtype='float64'} [id D] '' 3 # | |Shape_i{0} [id E] '' 2 # | |M [id F] # |TensorConstant{1.0} [id G] # |Elemwise{add,no_inplace} [id H] '' 1 # | |M [id F] # | |InplaceDimShuffle{x,x} [id I] '' 0 # | |a [id J] # |v [id K] # |TensorConstant{0.0} [id L]">
import aesara
from aesara import tensor as aet

# Declare two symbolic floating-point scalars
a = aet.dscalar("a")
b = aet.dscalar("b")

# Create a simple example expression
c = a + b

# Convert the expression into a callable object that takes `(a, b)`
# values as input and computes the value of `c`.
f_c = aesara.function([a, b], c)

assert f_c(1.5, 2.5) == 4.0

# Compute the gradient of the example expression with respect to `a`
dc = aesara.grad(c, a)

f_dc = aesara.function([a, b], dc)

assert f_dc(1.5, 2.5) == 1.0

# Compiling functions with `aesara.function` also optimizes
# expression graphs by removing unnecessary operations and
# replacing computations with more efficient ones.

v = aet.vector("v")
M = aet.matrix("M")

d = a/a + (M + a).dot(v)

aesara.dprint(d)
# Elemwise{add,no_inplace} [id A] ''
#  |InplaceDimShuffle{x} [id B] ''
#  | |Elemwise{true_div,no_inplace} [id C] ''
#  |   |a [id D]
#  |   |a [id D]
#  |dot [id E] ''
#    |Elemwise{add,no_inplace} [id F] ''
#    | |M [id G]
#    | |InplaceDimShuffle{x,x} [id H] ''
#    |   |a [id D]
#    |v [id I]

f_d = aesara.function([a, v, M], d)

# `a/a` -> `1` and the dot product is replaced with a BLAS function
# (i.e. CGemv)
aesara.dprint(f_d)
# Elemwise{Add}[(0, 1)] [id A] ''   5
#  |TensorConstant{(1,) of 1.0} [id B]
#  |CGemv{inplace} [id C] ''   4
#    |AllocEmpty{dtype='float64'} [id D] ''   3
#    | |Shape_i{0} [id E] ''   2
#    |   |M [id F]
#    |TensorConstant{1.0} [id G]
#    |Elemwise{add,no_inplace} [id H] ''   1
#    | |M [id F]
#    | |InplaceDimShuffle{x,x} [id I] ''   0
#    |   |a [id J]
#    |v [id K]
#    |TensorConstant{0.0} [id L]

See the Aesara documentation for in-depth tutorials.

Installation

The latest release of Aesara can be installed from PyPI using pip:

pip install aesara

Or via conda-forge:

conda install -c conda-forge aesara

The current development branch of Aesara can be installed from GitHub, also using pip:

pip install git+https://github.com/aesara-devs/aesara

Support

Many Aesara developers are also PyMC developers, and, since the PyMC developers operate under the NumFOCUS umbrella, if you want to support them financially, consider donating here.

Special thanks to Bram Timmer for the logo.

Comments
  • Add C code for Erfcx

    Add C code for Erfcx

    Mentioned in #267

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [x] There is an informative high-level description of the changes.
    • [x] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [x] pre-commit is installed and set up.
    • [x] The commit messages follow these guidelines.
    • [x] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR. If your commit description starts with "Fix...", then you're probably making this mistake.
    • [x] There are tests covering the changes introduced in the PR.

    Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

    If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

    opened by ricardoV94 38
  • Replace C assertions with NAN in `gamma.c` and add tests for valid inputs

    Replace C assertions with NAN in `gamma.c` and add tests for valid inputs

    Closes #224

    I am not sure if it's as simple as this... Still researching a bit. I haven't found a single C example that explicitly returns NAN, so I might be doing something wrong. The code works on my machine though.


    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [x] There is an informative high-level description of the changes.
    • [x] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [x] pre-commit is installed and set up.
    • [x] The commit messages follow these guidelines.
    • [ ] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR. If your commit description starts with "Fix...", then you're probably making this mistake.
    • [x] There are tests covering the changes introduced in the PR.
    opened by ricardoV94 28
  • Add `Op`s for `solve_discrete_lyapunov` and `solve_continuous_lyapunov`

    Add `Op`s for `solve_discrete_lyapunov` and `solve_continuous_lyapunov`

    Following our discussions in #1015 and #1011, this PR adds Ops to aesara.tensor.slinalg that wrap scipy.linalg.solve_discrete_lyapunov and scipy.linalg.solve_continuous_lyapunov, as well as compute the reverse-mode gradients for each.

    One note, I had an error from mypy when running the pre-commit hooks: aesara\link\c\cmodule.py:2439: error: Unused "type: ignore" comment

    But this is unrelated to any changes i made, so I didn't know what to do with it.

    SciPy compatibility tensor algebra Op implementation 
    opened by jessegrabowski 25
  • Use Numba, Cython, and JAX for Python-implemented Ops

    Use Numba, Cython, and JAX for Python-implemented Ops

    Here's an old example of a Numba-enabled Theano Op. We can most likely do something similar for Cython and JAX, as well.

    As an extension to that example, it would be nice to have the compiled function be the Op.perform method itself; that way, we could attempt to compile existing Ops with little-to-no changes.

    enhancement 
    opened by brandonwillard 23
  • Deprecate `nnet` and `signal` modules

    Deprecate `nnet` and `signal` modules

    In this PR we begin phasing the nnet and signal modules outside of Aesara, following discussion in https://github.com/aesara-devs/aesara/issues/674.

    • [x] Disable auto-importing from aesara.tensor
    • [x] Remove aesara.tensor.nnet and aesara.tensor.signal tests
    • [x] Add deprecation warnings in nnet module
    • [x] Add deprecation warnings in signal module
    • [x] Move Softmax out of aesara.tensor.nnet.basic -> aesara.tensor.math
    • [x] Move LogSoftmax out of aesara.tensor.nnet.basic -> aesara.tensor.math
    • [x] Move SoftmaxGrad out of aesara.tensor.nnet -> aesara.tensor.math
    • [x] Move tests for Softmax, LogSoftmax, SoftmaxGrad
    • [x] Move rewrites related to Softmax, LogSoftmax, SoftmaxGrad
    • [x] Rename logsoftmax -> log_softmax
    • [x] Remove nnet and signal from the documentation, and any mention of anything NN-related

    Anything else we want to salvage ?

    important refactor 
    opened by rlouf 22
  • Catch Numpy

    Catch Numpy "Could not locate executable" warnings

    Closes https://github.com/conda-forge/aesara-feedstock/issues/54 by capturing stderr while reading blas_info from Numpy.

    Specifically, the suppressed errors appear on Windows and look like

    >>> import aesara
    WARN: Could not locate executable g77
    WARN: Could not locate executable f77
    WARN: Could not locate executable ifort
    WARN: Could not locate executable ifl
    WARN: Could not locate executable f90
    WARN: Could not locate executable DF
    WARN: Could not locate executable efl
    

    I am having trouble running the pytest suite locally. Additionally, I have no means of testing this locally since I don't have Windows.

    I have not yet written any tests, but I'm open to advice.

    I did this a bit rushed, so apologies in advance in case I missed some guideline.


    Thank you for opening a PR!

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [X] There is an informative high-level description of the changes.
    • [X] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [X] pre-commit is installed and set up.
    • [X] The commit messages follow these guidelines.
    • [X] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
    • [x] There are tests covering the changes introduced in the PR.

    Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

    If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

    testing CI Windows 
    opened by maresb 22
  • Beta often diverges when logodds is close to 19.0

    Beta often diverges when logodds is close to 19.0

    Description

    This simple model never diverges in NUTS:

    import numpy as np
    import pymc3 as pm
    
    with pm.Model() as good_model:
        good_beta = pm.Beta('good_beta', alpha=0.25, beta=3.0, shape=40)
    
    with good_model:
        good_trace = pm.sample(draws=600, chains=2, tune=500) 
    

    But this very similar model---with alpha and beta swapped---diverges on about half the samples:

    import numpy as np
    import pymc3 as pm
    
    with pm.Model() as bad_model:
        bad_beta = pm.Beta('bad_beta', alpha=3.0, beta=0.25, shape=40)
    
    with bad_model:
        bad_trace = pm.sample(draws=600, chains=2, tune=500)
    
    Sampling 2 chains for 500 tune and 600 draw iterations (1_000 + 1_200 draws total) took 17 seconds.
    There were 328 divergences after tuning. Increase `target_accept` or reparameterize.
    There were 282 divergences after tuning. Increase `target_accept` or reparameterize.
    The acceptance probability does not match the target. It is 0.8848443240050202, but should be close to 0.8. Try to increase the number of tuning steps.
    The estimated number of effective samples is smaller than 200 for some parameters.
    

    The problem appears to be that in the diverging samples, one element of bad_beta jumps to a logodds that is close to (but less than) the value 19.0

    def max_bad_beta(warning):
        return np.amax(warning.extra['bad_beta_logodds__'])
    
    def logodds_and_beta(value):
        return value, pm.transforms.logodds.backward(value).eval()[()]
    
    def maxs_from_warnings(trace, limit=50):
        warnings = trace.report._warnings[:limit]
        return [logodds_and_beta(max_bad_beta(warning)) for warning in warnings]
    
    maxs_from_warnings(bad_trace)
    [(18.522285926243683, 0.9999999909661387),
     (18.026951801202443, 0.9999999851750137),
     (18.273787751452954, 0.9999999884176999),
     (15.811521213093858, 0.9999998641237577),
     (18.788894703456123, 0.999999993080309),
     (17.840933189508505, 0.9999999821441242),
     (18.99068873589819, 0.9999999943447908),
     (18.650396555754487, 0.9999999920524058),
     (18.886465782831156, 0.9999999937235782),
     (18.614120566380194, 0.9999999917588059),
     (18.748619470023584, 0.9999999927959284),
     (18.96328594127111, 0.9999999941876794),
     (18.43516905323891, 0.9999999901438387),
     (18.7824011307429, 0.9999999930352292),
     (18.61426914065103, 0.9999999917600301),
     (18.61426914065103, 0.9999999917600301),
     (18.959200871340606, 0.9999999941638871),
     (18.310579256420056, 0.9999999888360865),
     (18.875771090438388, 0.9999999936560935),
     (18.419609630862556, 0.9999999899892832),
     (18.743196196992155, 0.9999999927567527), 
    ...
    ]
    

    What is special about 19? Note that good_beta generates logodds close to -19.0 as often as bad_beta generates logodds close to 19.0, but good_beta never diverges.

    Versions and main components

    • PyMC3 Version: 3.9.1
    • Theano Version: 1.0.4
    • Python Version: 3.8.3
    • Operating system: macOS 10.15.16
    • How did you install PyMC3: conda
    bug 
    opened by bridgeland 20
  • Use `broadcast_to` instead of `broadcast_like`

    Use `broadcast_to` instead of `broadcast_like`

    Closes #159. WIP.

    Two questions:

    1. Changing broadcast_like to broadcast_to in aesara/tensor/math_opt.py gives me a lot of BadOptimization and AssertionErrors, which I'm not knowledgeable enough to debug - can someone help me understand what's happening?
    2. ~I've also changed broadcast_like to broadcast_to in aesara/tensor/basic_opt.py - is this something we want to do?~
    opened by eigenfoo 19
  • Fix/remove confusing __iter__ implementation in theano.tensor.var.TensorVariable

    Fix/remove confusing __iter__ implementation in theano.tensor.var.TensorVariable

    I'm trying to translate Statistical Rethinking from R and RStan to Python and PyMC3.

    On page 304, there's a simple logistic regression example. Data being used (publicly available):

    	dept	applicant.gender	admit	reject	applications	is_male
    1	A	male	512	313	825	1
    2	A	female	89	19	108	0
    3	B	male	353	207	560	1
    4	B	female	17	8	25	0
    5	C	male	120	205	325	1
    6	C	female	202	391	593	0
    7	D	male	138	279	417	1
    8	D	female	131	244	375	0
    9	E	male	53	138	191	1
    10	E	female	94	299	393	0
    11	F	male	22	351	373	1
    12	F	female	24	317	341	0
    

    Data is stored in a pandas DataFrame object. When I try and fit the model using:

    with pm.Model() as m106:
        
        alpha = pm.Normal('alpha', 0, 10)
        beta_m = pm.Normal('beta_m', 0, 10)
        
        lin = alpha + beta_m * data['is_male']
        p = np.exp(lin) / (1 + np.exp(lin))
        
        admit = pm.Binomial('admit', n=data['applications'], p=p, observed=data['admit'])
        
        m106_map = pm.find_MAP()
        m106_traces = pm.sample(1000, start=m106_map)
    

    I get the following error (which seems similar to pymc-devs/pymc3#918):

    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/type.py in dtype_specs(self)
        266                 'complex64': (complex, 'theano_complex64', 'NPY_COMPLEX64')
    --> 267             }[self.dtype]
        268         except KeyError:
    
    KeyError: 'object'
    
    During handling of the above exception, another exception occurred:
    
    TypeError                                 Traceback (most recent call last)
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in constant_or_value(x, rtype, name, ndim, dtype)
        407             rval = rtype(
    --> 408                 TensorType(dtype=x_.dtype, broadcastable=bcastable),
        409                 x_.copy(),
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/type.py in __init__(self, dtype, broadcastable, name, sparse_grad)
         49         self.broadcastable = tuple(bool(b) for b in broadcastable)
    ---> 50         self.dtype_specs()  # error checking is done there
         51         self.name = name
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/type.py in dtype_specs(self)
        269             raise TypeError("Unsupported dtype for %s: %s"
    --> 270                             % (self.__class__.__name__, self.dtype))
        271 
    
    TypeError: Unsupported dtype for TensorType: object
    
    During handling of the above exception, another exception occurred:
    
    TypeError                                 Traceback (most recent call last)
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in as_tensor_variable(x, name, ndim)
        201     try:
    --> 202         return constant(x, name=name, ndim=ndim)
        203     except TypeError:
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in constant(x, name, ndim, dtype)
        421     ret = constant_or_value(x, rtype=TensorConstant, name=name, ndim=ndim,
    --> 422                             dtype=dtype)
        423 
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in constant_or_value(x, rtype, name, ndim, dtype)
        416     except Exception:
    --> 417         raise TypeError("Could not convert %s to TensorType" % x, type(x))
        418 
    
    TypeError: ('Could not convert 1     Elemwise{mul,no_inplace}.0\n2     Elemwise{mul,no_inplace}.0\n3     Elemwise{mul,no_inplace}.0\n4     Elemwise{mul,no_inplace}.0\n5     Elemwise{mul,no_inplace}.0\n6     Elemwise{mul,no_inplace}.0\n7     Elemwise{mul,no_inplace}.0\n8     Elemwise{mul,no_inplace}.0\n9     Elemwise{mul,no_inplace}.0\n10    Elemwise{mul,no_inplace}.0\n11    Elemwise{mul,no_inplace}.0\n12    Elemwise{mul,no_inplace}.0\nName: applications, dtype: object to TensorType', <class 'pandas.core.series.Series'>)
    
    During handling of the above exception, another exception occurred:
    
    AsTensorError                             Traceback (most recent call last)
    <ipython-input-144-fb615dfa2e93> in <module>()
          7     p = np.exp(lin) / (1 + np.exp(lin))
          8 
    ----> 9     admit = pm.Binomial('admit', n=data['applications'], p=p, observed=data['admit'])
         10 
         11     m106_map = pm.find_MAP()
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
         24         if isinstance(name, string_types):
         25             data = kwargs.pop('observed', None)
    ---> 26             dist = cls.dist(*args, **kwargs)
         27             return model.Var(name, dist, data)
         28         elif name is None:
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/pymc3/distributions/distribution.py in dist(cls, *args, **kwargs)
         37     def dist(cls, *args, **kwargs):
         38         dist = object.__new__(cls)
    ---> 39         dist.__init__(*args, **kwargs)
         40         return dist
         41 
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/pymc3/distributions/discrete.py in __init__(self, n, p, *args, **kwargs)
         43         self.n = n
         44         self.p = p
    ---> 45         self.mode = tt.cast(tt.round(n * p), self.dtype)
         46 
         47     def random(self, point=None, size=None, repeat=None):
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in round(a, mode)
       2052     """round_mode(a) with mode in [half_away_from_zero, half_to_even]"""
       2053     if mode == "half_away_from_zero":
    -> 2054         return round_half_away_from_zero(a)
       2055     elif mode == "half_to_even":
       2056         return round_half_to_even(a)
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
        609         """
        610         return_list = kwargs.pop('return_list', False)
    --> 611         node = self.make_node(*inputs, **kwargs)
        612 
        613         if config.compute_test_value != 'off':
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/elemwise.py in make_node(self, *inputs)
        541         using DimShuffle.
        542         """
    --> 543         inputs = list(map(as_tensor_variable, inputs))
        544         shadow = self.scalar_op.make_node(
        545             *[get_scalar_type(dtype=i.type.dtype).make_variable()
    
    /Users/horatiu/anaconda/lib/python3.5/site-packages/theano/tensor/basic.py in as_tensor_variable(x, name, ndim)
        206         except Exception:
        207             str_x = repr(x)
    --> 208         raise AsTensorError("Cannot convert %s to TensorType" % str_x, type(x))
        209 
        210 # this has a different name, because _as_tensor_variable is the
    
    AsTensorError: ('Cannot convert 1     Elemwise{mul,no_inplace}.0\n2     Elemwise{mul,no_inplace}.0\n3     Elemwise{mul,no_inplace}.0\n4     Elemwise{mul,no_inplace}.0\n5     Elemwise{mul,no_inplace}.0\n6     Elemwise{mul,no_inplace}.0\n7     Elemwise{mul,no_inplace}.0\n8     Elemwise{mul,no_inplace}.0\n9     Elemwise{mul,no_inplace}.0\n10    Elemwise{mul,no_inplace}.0\n11    Elemwise{mul,no_inplace}.0\n12    Elemwise{mul,no_inplace}.0\nName: applications, dtype: object to TensorType', <class 'pandas.core.series.Series'>)
    

    The error is not very informative, and doesn't seem to point to my code. But when using:

    with pm.Model() as m106:
        
        alpha = pm.Normal('alpha', 0, 10)
        beta_m = pm.Normal('beta_m', 0, 10)
        
        lin = alpha + beta_m * data['is_male']
        p = np.exp(lin) / (1 + np.exp(lin))
        
        admit = pm.Binomial('admit', n=data['applications'].values, p=p, observed=data['admit'])
        
        m106_map = pm.find_MAP()
        m106_traces = pm.sample(1000, start=m106_map)
    

    So explicitly passing in the numpy array rather than the pandas Series:

    admit = pm.Binomial('admit', n=data['applications'].values, p=p, observed=data['admit'])
    

    Everything works as expected. I'm just trying to figure out why that is? Is there a reference in the documentation for this behavior? What is the lesson I should take away from this? :)

    Using pandas 0.19, numpy 1.11, pymc3.0rc2

    bug 
    opened by ghost 18
  • Add `name` argument to `Variable.clone`

    Add `name` argument to `Variable.clone`

    Thank you for opening a PR!

    This PR addresses this enhancement issue and adds an optional name argument when cloning a Variable

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [ ] There is an informative high-level description of the changes.
    • [ ] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [ ] pre-commit is installed and set up.
    • [ ] The commit messages follow these guidelines.
    • [ ] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
    • [ ] There are tests covering the changes introduced in the PR.

    Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

    If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

    enhancement 
    opened by wd60622 17
  • Handle duplicate indices in Numba implementation of `AdvancedIncSubtensor1`

    Handle duplicate indices in Numba implementation of `AdvancedIncSubtensor1`

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [x] There is an informative high-level description of the changes.
    • [x] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [ ] pre-commit is installed and set up.
    • [x] The commit messages follow these guidelines.
    • [x] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
    • [x] There are tests covering the changes introduced in the PR.

    First, this PR removes the incorrect numba implementation of AdvancedIncSubtensor, so this will now just fall back to objectmode, and be slow and correct. (We should also provide a numba impl for this, but that will be a separate PR).

    But we do add a new implementation for AdvancedIncSubtensor1 (the much more common case). Here, we also take advantage of the fact that sometimes we know the indices beforehand, so we can simplify bounds checks, and generate cleaner and faster assembly code.

    Also a one line fix for cumop accidentally made its way into the PR, but this is simple enough that maybe we can just keep it here? (it has its own commit). The problem was that the numba.prange loop had data races.

    fixes https://github.com/aesara-devs/aesara/issues/603

    bug important Numba 
    opened by aseyboldt 17
  • Improve the interface to JAX-compiled functions

    Improve the interface to JAX-compiled functions

    Consider the following probabilistic model:

    import aesara.tensor as at
    
    X_at = at.matrix('X')
    
    srng = at.random.RandomStream(0)
    
    tau_rv = srng.halfcauchy(0, 1)
    lambda_rv = srng.halfcauchy(0, 1, size=X_at.shape[-1])
    beta_rv = srng.normal(0, tau_rv * lambda_rv, size=X_at.shape[-1])
    
    eta = X_at @ beta_rv
    p = at.sigmoid(-eta)
    Y_rv = srng.bernoulli(p)
    

    In a typical bayesian modeling workflow, we want to be able to generate and use three functions:

    1. A function that samples from the prior joint distribution (initialize the values)
    2. A function that computes the model's logdensity
    3. A function that computes posterior predictive sampling

    In a workflow that uses JAX we typically want to be able to use jax.vmap with (1) and (3), and jax.grad with (2). While it is possible to do this with Aesara-compiled function, we need to go through unnecessary levels of indirections.

    Current behavior

    First, to use jax.grad we must use the vm.jit_fn attribute of the Aesara-compiled function and wrap the function so it returns a single value instead of a 1-element tuple:

    import aesara
    import aeppl
    import jax
    import numpy as np
    
    logprob, vvs = aeppl.joint_logprob(tau_rv, lambda_rv, beta_rv, Y_rv)
    
    logdensity_fn = aesara.function([X_at] + list(vvs), logprob, mode="JAX")
    try:
        jax.grad(logdensity_fn)(np.ones((3,2)), 1., np.ones(2), np.ones(2), np.ones(2))
    except Exception as e:
        print(e)
    # Bad input argument to aesara function with name "<stdin>:22" at index 0 (0-based).
    # Backtrace when that variable is created:
    
    #   File "<stdin>", line 3, in <module>
    # The numpy.ndarray conversion method __array__() was called on the JAX Tracer object Traced<ConcreteArray([[1. 1.]
    #  [1. 1.]
    #  [1. 1.]], dtype=float64)>with<JVPTrace(level=2/0)> with
    #   primal = array([[1., 1.],
    #        [1., 1.],
    #        [1., 1.]])
    #   tangent = Traced<ShapedArray(float64[3,2])>with<JaxprTrace(level=1/0)> with
    #     pval = (ShapedArray(float64[3,2]), None)
    #     recipe = LambdaBinding()
    # See https://jax.readthedocs.io/en/latest/errors.html#jax.errors.TracerArrayConversionError
    
    logdensity_jit_fn = aesara.function([X_at] + list(vvs), logprob, mode="JAX").vm.jit_fn
    try:
        jax.grad(logdensity_jit_fn)(np.ones((3,2)), np.array(1.), np.ones(2), np.ones(2), np.ones(3))
    except Exception as e:
        print(e)
    # Gradient only defined for scalar-output functions. Output was (Array(-12.65285075, dtype=float64),).
    
    def logdensity_squeezed_jit_fn(*x):
        return logdensity_jit_fn(*x)[0]
    print(jax.grad(logdensity_squeezed_jit_fn)(np.ones((3,2)), np.array(1.), np.ones(2), np.ones(2), np.ones(3)))
    # [[-0.88079708 -0.88079708]
    #  [-0.88079708 -0.88079708]
    #  [-0.88079708 -0.88079708]]
    

    To be able to use jax.vmap to sample multiple values from the prior distribution / do posterior predictive sampling we must also use the jit-compiled function directly. In addition, we must pass one PRNGKey per random variable in the graph which does not reflect the RandomStream mechanism, wrap them in a dictionary with the same structure as the internal random state, and pass them as the last arguments (first argument is idiomatic in JAX):

    prior_sample_fn = aesara.function([X_at], [tau_rv, lambda_rv, beta_rv], mode="JAX").vm.jit_fn
    rng_key = jax.random.PRNGKey(0)
    key1, key2, key3 = jax.random.split(rng_key, 3)
    print(prior_sample_fn(np.ones((2,3)), {"jax_state": key1}, {"jax_state": key2}, {"jax_state": key3}))
    

    Expected behavior

    I would expect to be able to use the compiled function just like any JAX function:

    logdensity_fn = aesara.function([X_at] + list(vvs), logprob, mode="JAX")
    jax.grad(logdensity_fn)(np.ones((3,2)), 1., np.ones(2), np.ones(2), np.ones(2))
    

    With the assumption that for random functions the first argument must be a JAX PRNGKey:

    prior_sample_fn = aesara.function([X_at], [tau_rv, lambda_rv, beta_rv], mode="JAX").vm.jit_fn
    
    rng_key = jax.random.PRNGKey(0)
    keys = jax.random.split(rng_key, 100)
    samples = jax.vmap(prior_sample_fn, in_axes=(0, None))(keys, np.ones((2,3)))
    

    Proposals

    To make the compiled functions truly compatible with JAX and the rest of its ecosystem I suggest the following changes:

    1. Function.__call__ should be immediately compatible with JAX; we shouldn't have to fetch the vm.jit_fn attribute. An Aesara function is supposed to manage other things like updates of SharedVariables, but I am not sure this is necessary for JAX-compiled functions. Furthermore, if it is supposed to do something that normally cannot be done with JAX then it would be preferable to fail during transpilation rather than output a function that cannot be composed with the rest of the JAX ecosystem;
    2. Function.__call__ should not return a tuple when there is a single output;
    3. The internal random state should be represented by the rng_key directly, and not a dictionary that contains the key;
    4. When there are several random variables in the graph, we should only require one PRNG key;
    5. The PRNG key should be passed as the first input
    6. Do not return the updated PRNG keys with the functions that take PRNG keys as inputs;

    Related to https://github.com/aesara-devs/aesara/issues/1194

    enhancement JAX 
    opened by rlouf 1
  • Migrate from setuptools to hatchling

    Migrate from setuptools to hatchling

    Base: #1371

    Change the build-backend from setuptools to hatchling.

    Question: Is there any reason for docs/ to be included in the sdist? It's not in the wheel.

    For some reason I'm having trouble including the file aesara/d3viz/html/template.html. I'm not sure yet why it's being excluded.

    Thank you for opening a PR!

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [X] There is an informative high-level description of the changes.
    • [x] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [x] pre-commit is installed and set up.
    • [x] The commit messages follow these guidelines.
    • [x] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
    • [ ] There are tests covering the changes introduced in the PR.

    Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

    If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

    enhancement 
    opened by maresb 5
  • Migrate from versioneer to setuptools_scm

    Migrate from versioneer to setuptools_scm

    The base of this PR is #1371. The first original commit on this branch is "Remove versioneer".

    In the first commit I remove versioneer and set the version to "TODO". In the second commit, I add setuptools_scm.

    I also attempt to correctly configure the nightly builds. I do this by running aesara.misc.prepare_nightly_build to modify pyproject.toml in the nightly build, updating the following entries:

    [project]
    name = "aesara-nightly"
    dynamic = []
    version = "[generated from aesara.misc.prepare_nightly_build:nightly_version_number]"
    
    [tool.setuptools_scm]
    (deleted)
    

    This should be tested, but I'm reasonably confident that it will work properly, and I raise an error if the version number has an incorrect form.

    One strange quirk which I don't quite understand is that in order to type-check aesara.misc.prepare_nightly_build I added the types-toml package to the mypy pre-commit config, and afterwards it raised an error about an unused type: ignore in aesara/scan/op.py L3430. Removing the type: ignore resolved the error. :man_shrugging:

    Thank you for opening a PR!

    Here are a few important guidelines and requirements to check before your PR can be merged:

    • [X] There is an informative high-level description of the changes.
    • [X] The description and/or commit message(s) references the relevant GitHub issue(s).
    • [X] pre-commit is installed and set up.
    • [X] The commit messages follow these guidelines.
    • [X] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
    • [ ] There are tests covering the changes introduced in the PR.

    Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

    If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

    CI 
    opened by maresb 17
  • Add `ChiSquareRV` JAX implementation

    Add `ChiSquareRV` JAX implementation

    Closes #1322

    Given the shape/rate parametrization of GammaRV in Aesara, this addition uses the fact that $$\chi^2_{\text{df}} \equiv \Gamma\left(\frac{\text{df}}{2}, \frac{1}{2} \right).$$

    Wiki reference here

    enhancement JAX random variables 
    opened by larryshamalama 1
Releases(rel-2.8.9)
  • rel-2.8.9(Nov 11, 2022)

    What's Changed

    • Add documentation for contributing to Aesara by @dgerlanc in https://github.com/aesara-devs/aesara/pull/1283
    • Do not always remap storage in fgraph_to_python by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1291

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.8...rel-2.8.9

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.8(Nov 3, 2022)

    What's Changed

    • Add gufunc signature to RandomVariable's docstrings by @rlouf in https://github.com/aesara-devs/aesara/pull/1160
    • Add support for shared inputs in numba_funcify_Scan by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1241
    • Remove redundant install/update instructions and Python/NumPy primers from documentation by @rlouf in https://github.com/aesara-devs/aesara/pull/1256
    • Mention common cases in issue template by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1266
    • Fix SharedVariable.value usage in broadcast_shape_iter by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1269
    • Deprecate nnet and signal modules by @rlouf in https://github.com/aesara-devs/aesara/pull/1188
    • Add documentation for aesara.as_symbolic by @anirudhacharya in https://github.com/aesara-devs/aesara/pull/1265
    • Add type hint to RandomVariable.rng_fn by @sujitpal in https://github.com/aesara-devs/aesara/pull/827
    • Add specialization for subtraction and addition with negative terms by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/549
    • Refactor output Type inference in RandomVariable and Scan by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1253
    • Use time.perf_counter for aesara.function timing results by @anirudhacharya in https://github.com/aesara-devs/aesara/pull/1262
    • Update flake8 repo and version in pre-commit config by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1278
    • Add Student's t RandomVariable by @rlouf in https://github.com/aesara-devs/aesara/pull/1211

    New Contributors

    • @anirudhacharya made their first contribution in https://github.com/aesara-devs/aesara/pull/1265
    • @sujitpal made their first contribution in https://github.com/aesara-devs/aesara/pull/827

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.7...rel-2.8.8

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.7(Oct 5, 2022)

    What's Changed

    • Add deprecation warning for rng_mrg by @rlouf in https://github.com/aesara-devs/aesara/pull/1187
    • Fix None output node bug in JITLinker.create_jitable_thunk by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1205
    • Update pre-commit hooks by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1208
    • Make isort ignore Cython files by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1209
    • Update Scan Gibbs sampling example by @LegrandNico in https://github.com/aesara-devs/aesara/pull/1189
    • Pin style CI job to Python 3.9 by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1210
    • Fix outdated stride logic in GEMM's C implementation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1219
    • Stop renaming variables in Scan's merge rewrite by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1218
    • Allow shared RandomState/Generator updates in JAX backend by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1214
    • Fix _debugprint's handling of empty profile data by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1224
    • Fix storage and mit-mot handling in numba_funcify_Scan by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1203
    • Make fgraph_to_python process Constant FunctionGraph outputs correctly by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1234

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.6...rel-2.8.7

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.6(Sep 21, 2022)

    What's Changed

    • Fix type inference in Elemwise when inputs have 0 shape by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1199
    • Fix split output type by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1201
    • Avoid duplicate input names in Numba's Scan transpilation by @rlouf in https://github.com/aesara-devs/aesara/pull/1198
    • Implement moveaxis helper by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1186

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.5...rel-2.8.6

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.5(Sep 19, 2022)

    What's Changed

    • Remove JAX omnistaging warning and add a warning for CheckAndRaise transpilation by @rlouf in https://github.com/aesara-devs/aesara/pull/1185
    • Update CheckAndRaise to handle ScalarType inputs by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1181
    • Clean up SparseTensorType by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1192
    • Allow TensorType.convert_variable to work with mixed static shapes by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1190

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.4...rel-2.8.5

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.4(Sep 14, 2022)

    What's Changed

    • Update options.package_data section by @eganster in https://github.com/aesara-devs/aesara/pull/1183

    New Contributors

    • @eganster made their first contribution in https://github.com/aesara-devs/aesara/pull/1183

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.3...rel-2.8.4

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.3(Sep 13, 2022)

    What's Changed

    • Refactor setuptools to use declarative setup.cfg by @maresb in https://github.com/aesara-devs/aesara/pull/1135
    • Remove defaults channel from conda env for docs by @maresb in https://github.com/aesara-devs/aesara/pull/1136
    • Split aesara.tensor.rewriting.basic rewrites by their aesara.tensor modules by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1139
    • Move tensor_copy rewrite to aesara.tensor.rewriting.basic by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1144
    • Add docstrings for RandomVariable Ops by @rlouf in https://github.com/aesara-devs/aesara/pull/1105
    • Support duplicate indices in AdvancedIncSubtensor1's Numba implementation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1143
    • Add a C implementation for BroadcastTo by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1130
    • Move Numba tests to their own sub-package by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1153
    • Add a rewrite that changes constant indices to unsigned integers by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1150
    • Add tensor conversion to Numpy-like helper functions by @ltoniazzi in https://github.com/aesara-devs/aesara/pull/1154
    • Make ChoiceRV behave like NumPy's choice by @rlouf in https://github.com/aesara-devs/aesara/pull/1163
    • Add tensor conversion to flatnonzero, nonzero_values, tile, inverse_permutation, and diag by @ltoniazzi in https://github.com/aesara-devs/aesara/pull/1166
    • Use static shape in outputs of Elemwise by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/821
    • Refactor the JAX dispatcher by @rlouf in https://github.com/aesara-devs/aesara/pull/1168

    New Contributors

    • @ltoniazzi made their first contribution in https://github.com/aesara-devs/aesara/pull/1154

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.2...rel-2.8.3

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.2(Aug 21, 2022)

    What's Changed

    • Fix broadcasting conditions in broadcast_shape_iter by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1138

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.1...rel-2.8.2

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.1(Aug 21, 2022)

    What's Changed

    • Fix handling of numpy.dtype input in TensorType by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1133

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.8.0...rel-2.8.1

    Source code(tar.gz)
    Source code(zip)
  • rel-2.8.0(Aug 20, 2022)

    What's Changed

    • Change use of "optimize" to "rewrite" by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1054
    • Add a C implementation for TensorFromScalar by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1124
    • Remove warnings from tests.tensor.test_[basic|var] by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1127
    • Add pip as an explicit docs dependency by @maresb in https://github.com/aesara-devs/aesara/pull/1132
    • Revert to lazy loaded aesara.link.c.cutils by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1131

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.10...rel-2.8.0

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.10(Aug 16, 2022)

    What's Changed

    • Change R-operator to L-operator in Lop docstring by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1087
    • Implement aesara.tensor.matmul by @zoj613 in https://github.com/aesara-devs/aesara/pull/744
    • Add a JAX implementation for FillDiagonal by @ferrine in https://github.com/aesara-devs/aesara/pull/1080
    • Add docstring for the GammaRV Op by @rlouf in https://github.com/aesara-devs/aesara/pull/1084
    • Refactor and fix static shape issues in IfElse by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1095
    • Add docstrings for RandomVariables by @rlouf in https://github.com/aesara-devs/aesara/pull/1091
    • Fix incorrect setuptools minimum version number by @maresb in https://github.com/aesara-devs/aesara/pull/1100
    • Add docstrings for dirichlet, geometric and hypergeometric distributions by @rlouf in https://github.com/aesara-devs/aesara/pull/1099
    • Allow size to broadcast CategoricalRV p argument by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1088
    • Add Owens-T Function Op by @RuneDominik in https://github.com/aesara-devs/aesara/pull/1083
    • Fix cache versioning of empty Op.__props__ by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1108
    • Allow JAX Reshape to work with constant shape inputs by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1111
    • Remove strict TensorType.broadcastable usage from local_elemwise_alloc by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1102
    • Remove unnecessary code in local_useless_AdvancedSubtensor1 and refactor tests by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1112

    New Contributors

    • @maresb made their first contribution in https://github.com/aesara-devs/aesara/pull/1100
    • @RuneDominik made their first contribution in https://github.com/aesara-devs/aesara/pull/1083

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.9...rel-2.7.10

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.9(Jul 26, 2022)

    What's Changed

    • Fix typing error in numba MakeVector impl by @aseyboldt in https://github.com/aesara-devs/aesara/pull/1070
    • Prevent Print from being constant folded by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1071
    • Convert Numba scalar outputs to ndarrays by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1073
    • Add some more Numba special functions by @aseyboldt in https://github.com/aesara-devs/aesara/pull/1077

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.8...rel-2.7.9

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.8(Jul 21, 2022)

    What's Changed

    • Replace distutils with setuptools by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1050
    • Make topogroup_optimizer use order argument by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1053
    • Fix size issue when using broadcastable dimensions in multivariate RandomVariables by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/1056
    • Implement generalized gamma distribution by @kylejcaron in https://github.com/aesara-devs/aesara/pull/1059
    • Add numba implementation for Split by @aseyboldt in https://github.com/aesara-devs/aesara/pull/1061
    • Fix the type hints in aesara.printing by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1064
    • Enable type checking for NumPy types by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1066

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.7...rel-2.7.8

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.7(Jul 12, 2022)

    What's Changed

    • Use context managers with open by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1049

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.6...rel-2.7.7

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.6(Jul 11, 2022)

    What's Changed

    • Update Op.grad, Op.L_op, and aesara.gradient docstrings and type hints by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1038
    • Generalize tril and triu beyond 2D arrays by @purna135 in https://github.com/aesara-devs/aesara/pull/1026
    • Replace uses of Rebroadcast by SpecifyShape by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/915
    • Fix Op.perform type hint by @michaelosthege in https://github.com/aesara-devs/aesara/pull/1016
    • Fix warning in ReplaceValide.replace_all_validate_remove by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1042
    • Update PyPI workflow to also build a wheel by @keesterbrugge in https://github.com/aesara-devs/aesara/pull/1048

    New Contributors

    • @purna135 made their first contribution in https://github.com/aesara-devs/aesara/pull/1026
    • @keesterbrugge made their first contribution in https://github.com/aesara-devs/aesara/pull/1048

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.5...rel-2.7.6

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.5(Jul 6, 2022)

    What's Changed

    • Remove useless complex conjugate Ops from graphs by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1025
    • Remove superfluous test value warning in Elemwise fusion rewrite by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1024
    • Fix NumPy docstring link by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1033
    • Fix a Scan Cython issue involving output storage lengths by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1035

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.4...rel-2.7.5

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.4(Jul 1, 2022)

    What's Changed

    • Make Apply.itypes's Type signature covariant by @aseyboldt in https://github.com/aesara-devs/aesara/pull/1010
    • Add dtype option to identity_like by @guyrt in https://github.com/aesara-devs/aesara/pull/1018
    • Implement work-around for Numba issue causing a segfault on M1 when using literal_unroll with booleans by @twiecki in https://github.com/aesara-devs/aesara/pull/1027

    New Contributors

    • @guyrt made their first contribution in https://github.com/aesara-devs/aesara/pull/1018

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.3...rel-2.7.4

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.3(Jun 18, 2022)

    What's Changed

    • Parameterize the types of some core graph objects by @brandonwillard in https://github.com/aesara-devs/aesara/pull/951
    • Clean up top-level tests by @brandonwillard in https://github.com/aesara-devs/aesara/pull/997
    • Use new JAX index update approach for AdvancedIncSubtensor by @qipengchen in https://github.com/aesara-devs/aesara/pull/927
    • Jax implementation of log1mexp by @kylejcaron in https://github.com/aesara-devs/aesara/pull/994
    • Make Elemwise.infer_shape return TensorTypeed values by @brandonwillard in https://github.com/aesara-devs/aesara/pull/1003

    New Contributors

    • @qipengchen made their first contribution in https://github.com/aesara-devs/aesara/pull/927
    • @kylejcaron made their first contribution in https://github.com/aesara-devs/aesara/pull/994

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.2...rel-2.7.3

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.2(Jun 14, 2022)

    What's Changed

    • Only attempt nightly builds on aesara-devs/aesara by @lucianopaz in https://github.com/aesara-devs/aesara/pull/983
    • Use input shapes to compute output shape in Elemwise.infer_shape by @brandonwillard in https://github.com/aesara-devs/aesara/pull/981
    • Broadcast matrix inputs to Gemm by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/986
    • Prevent unnecessary Scan inplace rewrites by @brandonwillard in https://github.com/aesara-devs/aesara/pull/993
    • Refine Scan's Cython implementation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/963
    • Add optional strict argument to Type.is_valid_value by @brandonwillard in https://github.com/aesara-devs/aesara/pull/995

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.1...rel-2.7.2

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.1(Jun 4, 2022)

    What's Changed

    • Update versioneer to fix build_ext bug by @mgorny in https://github.com/aesara-devs/aesara/pull/977
    • Added "What is Aesara" section to documentation by @Mount-Blanc in https://github.com/aesara-devs/aesara/pull/970
    • Clone inner-graph before compiling in OpFromGraph by @brandonwillard in https://github.com/aesara-devs/aesara/pull/976

    New Contributors

    • @Mount-Blanc made their first contribution in https://github.com/aesara-devs/aesara/pull/970

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.7.0...rel-2.7.1

    Source code(tar.gz)
    Source code(zip)
  • rel-2.7.0(Jun 3, 2022)

    What's Changed

    • Refactor updates functionality and Scan inner-graph compilation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/848
    • Print inner-graphs only once in debugprint by @brandonwillard in https://github.com/aesara-devs/aesara/pull/953
    • Remove deprecated Flatten and Tile Ops by @hectormz in https://github.com/aesara-devs/aesara/pull/948
    • Fix the type of t_fn in scan_perform.pyx by @brandonwillard in https://github.com/aesara-devs/aesara/pull/962
    • Add missing properties to copied Function objects by @brandonwillard in https://github.com/aesara-devs/aesara/pull/968
    • Increase lock scope in ModuleCache.refresh by @brandonwillard in https://github.com/aesara-devs/aesara/pull/969
    • Allow newlines in __str__ output printed by fgraph_to_python by @brandonwillard in https://github.com/aesara-devs/aesara/pull/975

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.6...rel-2.7.0

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.6(May 9, 2022)

    What's Changed

    • Update np.random usage, improve test seeding, and other misc. refactoring by @brandonwillard in https://github.com/aesara-devs/aesara/pull/949
    • Fix some input conversion issues in aesara.tensor by @brandonwillard in https://github.com/aesara-devs/aesara/pull/952

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.5...rel-2.6.6

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.5(May 7, 2022)

    What's Changed

    • Use SeedSequence in RandomStream by @brandonwillard in https://github.com/aesara-devs/aesara/pull/939
    • Add code of conduct by @dgerlanc in https://github.com/aesara-devs/aesara/pull/932
    • Add rewrite to merge consecutive Joined Subtensors by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/760
    • Fix static shape inference in DimShuffle by @brandonwillard in https://github.com/aesara-devs/aesara/pull/941
    • Allow broadcasting in Elemwise.c_code by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/928
    • Add Scan input/output type annotations to debugprint output by @brandonwillard in https://github.com/aesara-devs/aesara/pull/946
    • Patch ldflags and libs in GCC_compile under Windows by @lucianopaz in https://github.com/aesara-devs/aesara/pull/947

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.4...rel-2.6.5

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.4(Apr 24, 2022)

    What's Changed

    • Fix ScipyRandomVariable issue when size is None and parameters are all broadcastable by @brandonwillard in https://github.com/aesara-devs/aesara/pull/926

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.3...rel-2.6.4

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.3(Apr 23, 2022)

    What's Changed

    • Implement at.diff using basic slicing and subtraction Ops by @larryshamalama in https://github.com/aesara-devs/aesara/pull/901
    • Fix a type consistency issue in Apply.clone_with_new_inputs by @brandonwillard in https://github.com/aesara-devs/aesara/pull/925

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.2...rel-2.6.3

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.2(Apr 20, 2022)

    What's Changed

    • Add kwargs to OpFromGraphs constructed in OpFromGraph.make_node by @brandonwillard in https://github.com/aesara-devs/aesara/pull/920

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.1...rel-2.6.2

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.1(Apr 19, 2022)

    What's Changed

    • Fix error with scalar inputs in CAReduce and squeeze by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/914

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.6.0...rel-2.6.1

    Source code(tar.gz)
    Source code(zip)
  • rel-2.6.0(Apr 18, 2022)

    What's Changed

    • Added Ops for np.linspace, np.logspace, and np.geomspace by @kc611 in https://github.com/aesara-devs/aesara/pull/779
    • Rename Scalar to ScalarType by @brandonwillard in https://github.com/aesara-devs/aesara/pull/868
    • Add Numba implementation for DirichletRV and fix BroadcastTo bug by @brandonwillard in https://github.com/aesara-devs/aesara/pull/869
    • Use type name in Elemwise and CAReduce __str__ implementations by @brandonwillard in https://github.com/aesara-devs/aesara/pull/872
    • Remove old warning when using a dict for updates by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/873
    • Validate axis in CAReduce and handle negative axis in squeeze by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/834
    • Add JAX dispatch for SolveTriangular Op by @zaxtax in https://github.com/aesara-devs/aesara/pull/880
    • Load the sparse shared constructor support at package-level by @brandonwillard in https://github.com/aesara-devs/aesara/pull/882
    • Remove libgpuarray by @ferrine in https://github.com/aesara-devs/aesara/pull/614
    • Add JAX implementation for BroadcastTo by @danhphan in https://github.com/aesara-devs/aesara/pull/883
    • Fix Scan.truncate_gradient default value and type by @brandonwillard in https://github.com/aesara-devs/aesara/pull/892
    • Raise when SharedVariables are used as inputs of OpFromGraph by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/891
    • Fix typing issues in aesara.scan by @brandonwillard in https://github.com/aesara-devs/aesara/pull/894
    • Fix aesara.tensor.zeros and aesara.tensor.ones with symbolic scalar shape values by @danhphan in https://github.com/aesara-devs/aesara/pull/889
    • Make OpFromGraph.make_node interface consistent with its Apply nodes by @brandonwillard in https://github.com/aesara-devs/aesara/pull/902
    • Do not use CheckAndRaise c_code for non-dense inputs by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/899
    • Remove unnecessary cloning from Scan rewrites by @brandonwillard in https://github.com/aesara-devs/aesara/pull/903
    • Fix shared variable comparisons in OpFromGraph.make_node by @brandonwillard in https://github.com/aesara-devs/aesara/pull/905
    • Enabled type checking as described by PEP 561 by @michaelosthege in https://github.com/aesara-devs/aesara/pull/799
    • Add a missing inputs check to OpFromGraph by @brandonwillard in https://github.com/aesara-devs/aesara/pull/906
    • Allow shared variable input changes in OpFromGraph.make_node by @brandonwillard in https://github.com/aesara-devs/aesara/pull/907
    • Make SciPy-based RandomVariable return values writeable by @brandonwillard in https://github.com/aesara-devs/aesara/pull/908
    • Update the Cython Scan implementation's version number by @brandonwillard in https://github.com/aesara-devs/aesara/pull/911
    • Allow partial shape information in SpecifyShape Op by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/825
    • Remove default_updates from variables created in a Scan loop function by @brandonwillard in https://github.com/aesara-devs/aesara/pull/910

    New Contributors

    • @zaxtax made their first contribution in https://github.com/aesara-devs/aesara/pull/880

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.5.3...rel-2.6.0

    Source code(tar.gz)
    Source code(zip)
  • rel-2.5.3(Mar 18, 2022)

    What's Changed

    • Fix Numba CAReduce infinite identity values for non-floats by @brandonwillard in https://github.com/aesara-devs/aesara/pull/865
    • Convert SciPy scalar function inputs to acceptable dtypes in Numba implementations by @brandonwillard in https://github.com/aesara-devs/aesara/pull/866
    • Use params argument in Numba's default Op.perform implementation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/867

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.5.2...rel-2.5.3

    Source code(tar.gz)
    Source code(zip)
  • rel-2.5.2(Mar 17, 2022)

    What's Changed

    • Add rewrites to remove unnecessary expm1 operations by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/759
    • Fix DiffOp output type when input has partially known shape by @ricardoV94 in https://github.com/aesara-devs/aesara/pull/855
    • Make Sparse tensor Types extend TensorType by @aerubanov in https://github.com/aesara-devs/aesara/pull/766
    • Use new JAX index update approach when available by @brandonwillard in https://github.com/aesara-devs/aesara/pull/864
    • Convert shapes to scalar tuples in the Numba BroadcastTo implementation by @brandonwillard in https://github.com/aesara-devs/aesara/pull/863

    Full Changelog: https://github.com/aesara-devs/aesara/compare/rel-2.5.1...rel-2.5.2

    Source code(tar.gz)
    Source code(zip)
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.3k Feb 12, 2021
An implementation of chunked, compressed, N-dimensional arrays for Python.

Zarr Latest Release Package Status License Build Status Coverage Downloads Gitter Citation What is it? Zarr is a Python package providing an implement

Zarr Developers 1.1k Dec 30, 2022
OCTIS: Comparing Topic Models is Simple! A python package to optimize and evaluate topic models (accepted at EACL2021 demo track)

OCTIS : Optimizing and Comparing Topic Models is Simple! OCTIS (Optimizing and Comparing Topic models Is Simple) aims at training, analyzing and compa

MIND 478 Jan 1, 2023
A PyTorch-based open-source framework that provides methods for improving the weakly annotated data and allows researchers to efficiently develop and compare their own methods.

Knodle (Knowledge-supervised Deep Learning Framework) - a new framework for weak supervision with neural networks. It provides a modularization for se

null 93 Nov 6, 2022
Clinica is a software platform for clinical research studies involving patients with neurological and psychiatric diseases and the acquisition of multimodal data

Clinica Software platform for clinical neuroimaging studies Homepage | Documentation | Paper | Forum | See also: AD-ML, AD-DL ClinicaDL About The Proj

ARAMIS Lab 165 Dec 29, 2022
Ludwig is a toolbox that allows to train and evaluate deep learning models without the need to write code.

Translated in ???? Korean/ Ludwig is a toolbox that allows users to train and test deep learning models without the need to write code. It is built on

Ludwig 8.7k Jan 5, 2023
Ludwig is a toolbox that allows to train and evaluate deep learning models without the need to write code.

Translated in ???? Korean/ Ludwig is a toolbox that allows users to train and test deep learning models without the need to write code. It is built on

Ludwig 8.7k Dec 31, 2022
Narya API allows you track soccer player from camera inputs, and evaluate them with an Expected Discounted Goal (EDG) Agent

Narya The Narya API allows you track soccer player from camera inputs, and evaluate them with an Expected Discounted Goal (EDG) Agent. This repository

Paul Garnier 121 Dec 30, 2022
MacroTools provides a library of tools for working with Julia code and expressions.

MacroTools.jl MacroTools provides a library of tools for working with Julia code and expressions. This includes a powerful template-matching system an

FluxML 278 Dec 11, 2022
An end-to-end machine learning library to directly optimize AUC loss

LibAUC An end-to-end machine learning library for AUC optimization. Why LibAUC? Deep AUC Maximization (DAM) is a paradigm for learning a deep neural n

Andrew 75 Dec 12, 2022
A Python library created to assist programmers with complex mathematical functions

libmaths libmaths was created not only as a learning experience for me, but as a way to make mathematical models in seconds for Python users using mat

Simple 73 Oct 2, 2022
Let Python optimize the best stop loss and take profits for your TradingView strategy.

TradingView Machine Learning TradeView is a free and open source Trading View bot written in Python. It is designed to support all major exchanges. It

Robert Roman 473 Jan 9, 2023
TensorFlow implementation for Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How

Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How TensorFlow implementation for Bayesian Modeling and Unce

Shen Lab at Texas A&M University 8 Sep 2, 2022
Open-L2O: A Comprehensive and Reproducible Benchmark for Learning to Optimize Algorithms

Open-L2O This repository establishes the first comprehensive benchmark efforts of existing learning to optimize (L2O) approaches on a number of proble

VITA 161 Jan 2, 2023
Official implementation for "Symbolic Learning to Optimize: Towards Interpretability and Scalability"

Symbolic Learning to Optimize This is the official implementation for ICLR-2022 paper "Symbolic Learning to Optimize: Towards Interpretability and Sca

VITA 8 Dec 19, 2022
HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events globally on daily to subseasonal timescales.

HeatNet HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events glob

Google Research 6 Jul 7, 2022
Prototypical python implementation of the trust-region algorithm presented in Sequential Linearization Method for Bound-Constrained Mathematical Programs with Complementarity Constraints by Larson, Leyffer, Kirches, and Manns.

Prototypical python implementation of the trust-region algorithm presented in Sequential Linearization Method for Bound-Constrained Mathematical Programs with Complementarity Constraints by Larson, Leyffer, Kirches, and Manns.

null 3 Dec 2, 2022
Turning SymPy expressions into PyTorch modules.

sympytorch A micro-library as a convenience for turning SymPy expressions into PyTorch Modules. All SymPy floats become trainable parameters. All SymP

Patrick Kidger 89 Dec 13, 2022