Skip to content
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

Add SharedVariable.default_update graphs to debugprint #1412

Merged

Conversation

brandonwillard
Copy link
Member

This PR adds a print_default_updates option to debugprint that shows all the
SharedVariable.default_updates in a graph.

import aesara
import aesara.tensor as at


srng = at.random.RandomStream(903902)

a = at.vector("a")
mu = 2 * a
sigma = srng.invgamma(0.5, 0.5, name="sigma")
X_rv = srng.normal(mu, at.sqrt(sigma), name="X")

aesara.dprint(X_rv, print_default_updates=True)
# normal_rv{0, (0, 0), floatX, False}.1 [id A] 'X'
#  |RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7F2A98FAED60>) [id B] <- [id A]
#  |TensorConstant{[]} [id C]
#  |TensorConstant{11} [id D]
#  |Elemwise{mul,no_inplace} [id E]
#  | |InplaceDimShuffle{x} [id F]
#  | | |TensorConstant{2} [id G]
#  | |a [id H]
#  |Elemwise{sqrt,no_inplace} [id I]
#    |invgamma_rv{0, (0, 0), floatX, False}.1 [id J] 'sigma'
#      |RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7F2A98FAEBA0>) [id K] <- [id J]
#      |TensorConstant{[]} [id L]
#      |TensorConstant{11} [id M]
#      |TensorConstant{0.5} [id N]
#      |TensorConstant{0.5} [id O]
#
# Default updates:
#
# normal_rv{0, (0, 0), floatX, False}.0 [id A]
#  |RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7F2A98FAED60>) [id B] <- [id A]
#  |TensorConstant{[]} [id C]
#  |TensorConstant{11} [id D]
#  |Elemwise{mul,no_inplace} [id E]
#  |Elemwise{sqrt,no_inplace} [id I]
#
# invgamma_rv{0, (0, 0), floatX, False}.0 [id J]
#  |RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7F2A98FAEBA0>) [id K] <- [id J]
#  |TensorConstant{[]} [id L]
#  |TensorConstant{11} [id M]
#  |TensorConstant{0.5} [id N]
#  |TensorConstant{0.5} [id O]

@brandonwillard brandonwillard self-assigned this Feb 6, 2023
@brandonwillard brandonwillard added enhancement New feature or request tooling Relates to developer tools for printing, debugging, and/or manipulating Aesara objects labels Feb 6, 2023
@brandonwillard brandonwillard enabled auto-merge (rebase) February 7, 2023 00:24
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #1412 (d0535e1) into main (b64cb85) will increase coverage by 0.03%.
The diff coverage is 86.42%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1412      +/-   ##
==========================================
+ Coverage   74.69%   74.72%   +0.03%     
==========================================
  Files         194      194              
  Lines       49730    49866     +136     
  Branches    10527    10549      +22     
==========================================
+ Hits        37145    37262     +117     
- Misses      10262    10274      +12     
- Partials     2323     2330       +7     
Impacted Files Coverage Δ
aesara/tensor/rewriting/math.py 85.95% <80.95%> (-0.07%) ⬇️
aesara/scalar/math.py 85.00% <82.55%> (-0.30%) ⬇️
aesara/printing.py 51.48% <100.00%> (+1.07%) ⬆️
aesara/tensor/inplace.py 100.00% <100.00%> (ø)
aesara/tensor/math.py 90.42% <100.00%> (+0.03%) ⬆️
aesara/tensor/special.py 90.90% <100.00%> (+0.26%) ⬆️

@brandonwillard brandonwillard merged commit a5008d1 into aesara-devs:main Feb 7, 2023
@brandonwillard brandonwillard deleted the debugprint-default-updates branch February 7, 2023 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tooling Relates to developer tools for printing, debugging, and/or manipulating Aesara objects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant