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

dev(feat): add constraint to treetensor #16

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

Conversation

HansBug
Copy link
Member

@HansBug HansBug commented Dec 23, 2022

No description provided.

@HansBug HansBug added the enhancement New feature or request label Dec 23, 2022
@HansBug HansBug self-assigned this Dec 23, 2022
@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Merging #16 (455fd13) into main (5371923) will increase coverage by 0.15%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   97.19%   97.35%   +0.15%     
==========================================
  Files          33       37       +4     
  Lines        1607     1665      +58     
==========================================
+ Hits         1562     1621      +59     
+ Misses         45       44       -1     
Flag Coverage Δ
unittests 97.35% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
treetensor/common/__init__.py 100.00% <100.00%> (ø)
treetensor/common/constraints/__init__.py 100.00% <100.00%> (ø)
treetensor/common/constraints/shape.py 100.00% <100.00%> (ø)
treetensor/common/object.py 100.00% <100.00%> (ø)
treetensor/common/trees.py 90.00% <100.00%> (+1.47%) ⬆️
treetensor/torch/__init__.py 97.61% <100.00%> (+0.11%) ⬆️
treetensor/torch/constraints/__init__.py 100.00% <100.00%> (ø)
treetensor/torch/constraints/shape.py 100.00% <100.00%> (ø)
treetensor/torch/size.py 100.00% <100.00%> (ø)
treetensor/torch/tensor.py 99.37% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

from .shape import __all__ as _shape_all

__all__ = [
*_shape_all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments, such as some functions examples

if constraint:
return constraint.prefix
else:
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should raise RuntimeError here

treetensor/common/constraints/shape.py Show resolved Hide resolved
assert not c1 > shape_prefix(2, 3, 3)
assert not c1 < shape_prefix(2, 3, 3)

assert not c1 >= np.ndarray
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this comparison, maybe we should add some explanation comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants