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

batch size > 1 (per GPU) #3

Open
varun19299 opened this issue Jun 5, 2023 · 2 comments
Open

batch size > 1 (per GPU) #3

varun19299 opened this issue Jun 5, 2023 · 2 comments

Comments

@varun19299
Copy link

varun19299 commented Jun 5, 2023

Hi,

Is it possible to use a batch-size (per GPU) larger than 1?

The model's forward pass currently contains statements such as,

.

It seems that stage0 and stage2 should be amenable to batch processing by a simple rearrangement:
x_rearranged = rearrange(x, "b f c h w -> (b f) c h w").

How about stage_1? What modifications are needed for it to operate on a batchsize > 1?

@dasongli1
Copy link
Owner

Suppose the batch size is B and the batch size of input tensor is B, N, C, H, W = x.shape.
For frame-wise processing, x = x.view(B*N, C, H, W) -> 2D CNN processing.
For y in stage 2, y = x.view(B,N*C,H,W), y = torch.roll(y, slice_c,1), y = y.reshape(B*N, C, H, W)

@hiredd
Copy link

hiredd commented Oct 30, 2023

Suppose the batch size is B and the batch size of input tensor is B, N, C, H, W = x.shape. For frame-wise processing, x = x.view(B*N, C, H, W) -> 2D CNN processing. For y in stage 2, y = x.view(B,N*C,H,W), y = torch.roll(y, slice_c,1), y = y.reshape(B*N, C, H, W)
Can you explain it in more detail? thanks ~

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

3 participants