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

Follow-up's to #681 #683

Open
ascillitoe opened this issue Nov 24, 2022 · 0 comments
Open

Follow-up's to #681 #683

ascillitoe opened this issue Nov 24, 2022 · 0 comments
Assignees
Labels
Type: Maintenance Anything to do with library maintenance (CI, linting, refactoring etc.)
Milestone

Comments

@ascillitoe
Copy link
Contributor

ascillitoe commented Nov 24, 2022

Tracker for three items identified in #681.

Item 1 (#681 (comment))

Shallow copies are currently used to set and handle config, for example:

 cfg = self.config.copy()

This is OK if all any dictionary items are replaced, but might lead to unexpected behaviour if any items are mutated. We should audit all instances and replace with deepcopy where necessary.

Item 2 (#681 (comment))

We should replace kernel_a: Union[nn.Module, str] = 'rbf''s with Literal's in the kernel submodules, since rbf is the only permitted string value.

Item 3 (#681 (comment))

Possibly refactor if statements, e.g.:

Not a massive deal but rather than:

if backend == Framework.TENSORFLOW:
        kernel = load_kernel_config_tf(cfg)
elif backend == Framework.PYTORCH:
        kernel = load_kernel_config_pt(cfg)
else:  # backend=='keops'
        kernel = load_kernel_config_ke(cfg)

we might be able to do:

return {
    Framework.TENSORFLOW: load_kernel_config_tf,
    Framework.PYTORCH: load_kernel_config_pt,
    Framework.KEOPS: load_kernel_config_ko
}[backend]()
@ascillitoe ascillitoe added the Type: Maintenance Anything to do with library maintenance (CI, linting, refactoring etc.) label Nov 24, 2022
@ascillitoe ascillitoe added this to the v0.11.0 milestone Nov 24, 2022
@ascillitoe ascillitoe self-assigned this Nov 24, 2022
@ascillitoe ascillitoe changed the title Follow-up's to #656 Follow-up's to #681 Nov 28, 2022
@ascillitoe ascillitoe mentioned this issue Jan 19, 2023
3 tasks
@ascillitoe ascillitoe modified the milestones: v0.11.0, v0.12.0 Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Anything to do with library maintenance (CI, linting, refactoring etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant