DSL:

self.data = {}


TorchScript cannot infer the type of an empty dictionary (because there are no keys and values from which to infer the type). Try adding an annotation for this member at class scope:
class SpherePad(nn.Module):
    data: Dict[str, ...]

I can’t tell for sure based on your code by the value type here seems to be some nested dictionary type.