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

Vectorize filter bank computation for relaxed separable group convolutions #1

Open
2 tasks
dgcnz opened this issue May 21, 2024 · 0 comments
Open
2 tasks
Labels
enhancement New feature or request

Comments

@dgcnz
Copy link
Owner

dgcnz commented May 21, 2024

Description

Currently we generate each of the num_filter_banks weights by a loop, and we run sample_H for each of them.

# TODO: vectorize this for loop
weight_H = torch.stack(
[
self.sample_H(
H_product_H.flatten(0, 1),
self.weight_H[i].flatten(1, -1),
self.grid_H,
**self.sample_H_kwargs,
)
.view(
num_in_H,
num_out_H,
self.in_channels // self.groups,
self.out_channels,
*self.weight_dims,
)
.transpose(0, 3)
.transpose(1, 3)
for i in range(self.num_filter_banks)
],
dim=0,
)

This probably can be vectorized, like in the relaxed lifting example:

weight = self.sample_Rn(
self.weight.flatten(0, 1).repeat_interleave(H.shape[0], dim=0),
H_product.repeat(self.num_filter_banks * self.out_channels, *product_dims),
**self.sample_Rn_kwargs,
).view(
self.num_filter_banks,
self.out_channels,
num_H,
self.in_channels // self.groups,
*self.kernel_size,
)

Tasks

@dgcnz dgcnz added the enhancement New feature or request label May 21, 2024
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