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

style: add initial tensor shape typing to vae #2868

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

martinkim0
Copy link
Contributor

@martinkim0 martinkim0 commented Jun 28, 2024

closes #2541.

draft implementation of adding jaxtyping tensor shape annotation to vae

@martinkim0
Copy link
Contributor Author

martinkim0 commented Jun 28, 2024

Pros:

  • Same syntax across JAX, PyTorch, and NumPy (not sure about Xarray or Sparse yet)
  • Track shape annotations for tensors, which can make it easier to catch bugs earlier

Cons:

  • Can be tedious to add typing to every function - probably need to decide when it's recommended and when it's optional
  • Can sometimes lead to more verbose code

Other considerations:

  • Need to use the same axis names across all the models for consistency, so need a good system to sync these and manage axis name conflicts

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.51%. Comparing base (54ba452) to head (98f0ded).

Files with missing lines Patch % Lines
src/scvi/module/_vae.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2868      +/-   ##
==========================================
- Coverage   84.52%   84.51%   -0.02%     
==========================================
  Files         178      178              
  Lines       15048    15047       -1     
==========================================
- Hits        12720    12717       -3     
- Misses       2328     2330       +2     
Files with missing lines Coverage Δ
src/scvi/module/_vae.py 93.67% <90.00%> (-0.82%) ⬇️

@ori-kron-wis ori-kron-wis added this to the scvi-tools 1.2 milestone Sep 26, 2024
@ori-kron-wis ori-kron-wis added the on-merge: backport to 1.2.x on-merge: backport to 1.2.x label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-merge: backport to 1.2.x on-merge: backport to 1.2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding tensor/array shape annotations with jaxtyping
3 participants