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

Multi-batch unit tests for Lie groups #522

Merged
merged 9 commits into from
Jun 20, 2023
Merged

Conversation

luisenp
Copy link
Contributor

@luisenp luisenp commented May 29, 2023

Missing unit test for gradient ops

@luisenp luisenp requested a review from fantaosha May 29, 2023 19:16
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 29, 2023
Copy link
Contributor

@fantaosha fantaosha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Only minor comments.

all_input_types, atol = get_test_cfg(op_name, dtype, dim, data_shape, module=module)
for input_types in all_input_types:
inputs = sample_inputs(input_types, batch_size, dtype, rng)
funcs = (
tuple(left_project_func(module, x) for x in inputs)
tuple(left_project_func(module, x, bs) for x in inputs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we need to check bs=None or dim_out=None, which assumes no broadcasting and is most common user-case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the case tuple() covered this for the no batch size (see line 10). Or do you mean something else?

The tests for different dim_out are in #527.

matrix = matrix[sels, ..., sels, :, :]
g = group.reshape(d, *group.shape[-2:])
# Compute projected gradient matrix
ret = module._left_project_autograd_fn(g, matrix)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we assume the same dimension of inputs and outputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. There should be no broadcasting in the test where this function is used.

@luisenp luisenp merged commit aed9eb7 into main Jun 20, 2023
@luisenp luisenp deleted the lep.lie_binary_unit_tests branch June 20, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants