Skip to content

Add constraint within treevalue structure #50

Description

@HansBug

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions