Created
December 6, 2020 20:12
-
-
Save tchaton/f1260fa18801dd7902fa89ab58b3c54d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DNAConvNet(LightningModule): | |
... | |
def _convert_to_jittable(self, module): | |
for key, m in module._modules.items(): | |
if isinstance(m, MessagePassing) and m.jittable is not None: | |
# Pytorch Geometric MessagePassing implements a `.jittable` function | |
# which converts the current module into its jittable version. | |
module._modules[key] = m.jittable() | |
else: | |
self._convert_to_jittable(m) | |
return module | |
def jittable(self): | |
for key, m in self._modules.items(): | |
self._modules[key] = self._convert_to_jittable(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment