Skip to content

Instantly share code, notes, and snippets.

@tchaton
Created December 6, 2020 20:12
Show Gist options
  • Save tchaton/f1260fa18801dd7902fa89ab58b3c54d to your computer and use it in GitHub Desktop.
Save tchaton/f1260fa18801dd7902fa89ab58b3c54d to your computer and use it in GitHub Desktop.
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