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

Solution to run with irregular-sized batches #10

Open
dongliangcao opened this issue Dec 17, 2021 · 1 comment
Open

Solution to run with irregular-sized batches #10

dongliangcao opened this issue Dec 17, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@dongliangcao
Copy link

Dear author,

Thanks to your great work and code release for DiffusionNet. When I am working with DiffusionNet, I am wondering if there is a solution to train DiffusionNet with batch size larger than 1, even though the shape data might have different number of vertices.

Best regards,
Dongliang

@nmwsharp
Copy link
Owner

nmwsharp commented Jan 6, 2022

Hi Dongliang,

Glad to hear you're interested!

There isn't currently any code built-in to this repo for training on irregular-sized batches.

There are two main strategies we could follow here:

  • (A) Pad out the shorter entries with 0s or "fake" vertices so that all data has the same size. We might also want to incorporate "masks" of real/fake vertices so that some operations can ignore them (although I think the DiffusionNet code will mostly do the right thing if you just set the area to 0 for fake vertices). This is pretty easy, although it potentially wastes computation: the cost of the batch will be B * [biggest batch entry].
  • (B) Concatenate all entries in to one giant combined entry, then process with batch size 1. This is the strategy that e.g. Pytorch Geometric uses. This mostly works pretty well, except some operations/losses need to be modified take these combined data as input.

If we were going to add something to this repo, I'd probably lean towards option (A). We could add some utilities to make it easy to pad out irregular inputs, and double-check that all operations behave sanely with respect to padding.

Let me know if that sounds reasonable! I probably wouldn't get to implementing anything until Feb at the earliest, I'm pretty busy at the moment.

@nmwsharp nmwsharp added the enhancement New feature or request label Jan 6, 2022
@nmwsharp nmwsharp changed the title Solution to run with batch size larger than 1 Solution to run with irregular-sized batches Jan 6, 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

2 participants