IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
875B

  1. #
  2. # The goal of this module is to make Icosagon more efficient.
  3. # It takes the nice Icosagon model architecture and tries to
  4. # formulate it in terms of batch matrix multiplications instead
  5. # of using Python for loops.
  6. #
  7. from .weights import init_glorot
  8. from .input
  9. import torch
  10. class EncodeLayer(object):
  11. def __init__(self, num_relation_types, input_dim, output_dim):
  12. weights = [ init_glorot(input_dim, output_dim) \
  13. for _ in range(num_relation_types) ]
  14. weights = torch.cat(weights)
  15. class Compiler(object):
  16. def __init__(self, data: Data, layer_dimensions: List[int] = [32, 64]) -> None:
  17. self.data = data
  18. self.layer_dimensions = layer_dimensions
  19. self.build()
  20. def build(self) -> None:
  21. for fam in data.relation_families:
  22. init_glorot(in_channels, out_channels)