Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Refactor SharedVariable and its interfaces#1305

Merged
brandonwillard merged 4 commits intoaesara-devs:mainfrom
brandonwillard:refactor-SharedVariable-interface
Nov 21, 2022
Merged

Refactor SharedVariable and its interfaces#1305
brandonwillard merged 4 commits intoaesara-devs:mainfrom
brandonwillard:refactor-SharedVariable-interface

Conversation

@brandonwillard
Copy link
Member

This PR contains the following changes to SharedVariable and related machinery:

  • Use singledispatch to register type constructors
    • This removes some unnecessary redundancy and complexity.
  • Make SharedVariable.default_update a fixed property that defaults to None
    • This makes the interface clearer and its usage simpler.
  • Automatically perform Type checking and conversion when assigning to SharedVariable.default_update
    • This will help identify updates-related problems much earlier.
  • Misc. docstring and error message updates

`Type` checks are also performed when values are assigned to the property.
@brandonwillard brandonwillard self-assigned this Nov 20, 2022
@brandonwillard brandonwillard marked this pull request as draft November 20, 2022 02:57
@brandonwillard brandonwillard added the refactor This issue involves refactoring label Nov 20, 2022
@brandonwillard brandonwillard added this to the Clean up after Theano milestone Nov 20, 2022
@brandonwillard brandonwillard force-pushed the refactor-SharedVariable-interface branch 2 times, most recently from 69f3304 to 4d578d2 Compare November 20, 2022 06:07
@codecov
Copy link

codecov bot commented Nov 20, 2022

Codecov Report

Merging #1305 (65c6faf) into main (5aa1780) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1305      +/-   ##
==========================================
+ Coverage   74.10%   74.12%   +0.02%     
==========================================
  Files         174      174              
  Lines       48681    48660      -21     
  Branches    10379    10372       -7     
==========================================
- Hits        36074    36071       -3     
+ Misses      10313    10297      -16     
+ Partials     2294     2292       -2     
Impacted Files Coverage Δ
aesara/compile/function/pfunc.py 84.42% <100.00%> (+2.01%) ⬆️
aesara/compile/sharedvalue.py 93.75% <100.00%> (+13.26%) ⬆️
aesara/scan/basic.py 84.59% <100.00%> (ø)
aesara/sparse/sharedvar.py 94.11% <100.00%> (ø)
aesara/tensor/random/var.py 95.45% <100.00%> (-4.55%) ⬇️
aesara/tensor/sharedvar.py 82.60% <100.00%> (+5.05%) ⬆️

@brandonwillard brandonwillard force-pushed the refactor-SharedVariable-interface branch from 4d578d2 to 65c6faf Compare November 20, 2022 19:42
@brandonwillard brandonwillard marked this pull request as ready for review November 20, 2022 19:42
@brandonwillard brandonwillard changed the title Refactor SharedVariable and its interface Refactor SharedVariable and its interfaces Nov 20, 2022
@brandonwillard brandonwillard merged commit 3ad936f into aesara-devs:main Nov 21, 2022
@brandonwillard brandonwillard deleted the refactor-SharedVariable-interface branch November 21, 2022 02:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

refactor This issue involves refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant