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 constraint within treevalue structure #50

Open
HansBug opened this issue Jun 23, 2022 · 0 comments
Open

Add constraint within treevalue structure #50

HansBug opened this issue Jun 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@HansBug
Copy link
Member

HansBug commented Jun 23, 2022

For example, when treevalue is used in DI-treetensor, some tensors may have the same shape (all dimensions are the same) and partly-same shape (e.g. 1st dimension is the same).

Maybe a constraint should be provided, to simplify the result, such as

from treevalue import TreeValue
import torch

t = TreeValue({'a': torch.randn(2, 3), 'b': {'x': torch.randn(2, 4)}})
t.shape[0]  # should be a tree in current treevalue

# define some constraint
t.shape[0]  # should be 2 after defining
@HansBug HansBug added the enhancement New feature or request label Jun 23, 2022
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

No branches or pull requests

1 participant