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

Dynamical system on collections of tensors #162

Open
SimonKitSangChu opened this issue Jul 27, 2022 · 2 comments
Open

Dynamical system on collections of tensors #162

SimonKitSangChu opened this issue Jul 27, 2022 · 2 comments

Comments

@SimonKitSangChu
Copy link

SimonKitSangChu commented Jul 27, 2022

A dynamical system can often be described not by a single tensor but by multiple ones. For example, a system of particles can have node features, edge features, and global features, each with different feature dimensions.

While we might address the issue individually in each project, have there already been efforts to allow a collection of tensors as an input/output? For example,

def f(x: Dict[str, torch.Tensor]) -> Dict[str, torch.Tensor]:
    ...
   return {'node': out_node, 'edge': out_edge, 'global': x_global}
    
    
x = {'node': x_node, 'edge': x_edge, 'global': x_global}
model = NeuralODE(f)
out = model(x)

Alternatively, we can concatenate these tensors into a single one and de-concatenate it within f. Things can be non-trivial if the output shapes are different or might be a graph object itself.

@Zymrael
Copy link
Member

Zymrael commented Aug 12, 2022

There have been a few discussions on this particular point: several of our downstream users are interested in GNNs, and we've thus decided to support the heterogenous state case. See for example issue 137.

We should choose a type that is supported by torchscript (WIP 163), likely a NamedTuple of tensors (supported types).

Solver steps should then be modified to work on named tuples.

@SimonKitSangChu
Copy link
Author

Thanks. I will close the issue after heterogeneous state is also implemented for adaptive solver. Let me know when it is done.

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

No branches or pull requests

2 participants