def init(self):
              super(AttributeModule, self).init()
              self.foo = torch.jit.Attribute(0.1, float)
          # we should be able to use self.foo as a float here
          assert 0.0 < self.foo

          self.names_ages = torch.jit.Attribute({}, Dict[str, int])
          self.names_ages["someone"] = 20
          assert isinstance(self.names_ages["someone"], int)

  m = AttributeModule()
  # m will contain two attributes
  # 1. foo of type float
  # 2. names_ages of type Dict[str, int]

Note: it's now preferred to instead use type annotations instead of
   torch.jit.Annotate:
  import torch
  from typing import Dict

  class AttributeModule(torch.nn.Module):
      names: Dict[str, int]

      def __init__(self):
          super(AttributeModule, self).__init__()
          self.names = {}

  m = AttributeModule()

Parameters:
      * value -- An initial value to be assigned to attribute.