init the Embedding operator Args: input_dim (int): the number of different words in the dictionary output_dim (int): the dimendion of a word after the embedding initializer (str, optional): weight initializer, can be [uniform, gaussian]. Defaults to "unifo
(self, input_dim, output_dim, initializer="gaussian")
| 469 | """ |
| 470 | |
| 471 | def __init__(self, input_dim, output_dim, initializer="gaussian"): |
| 472 | """init the Embedding operator |
| 473 | Args: |
| 474 | input_dim (int): the number of different words in the dictionary |
| 475 | output_dim (int): the dimendion of a word after the embedding |
| 476 | initializer (str, optional): weight initializer, can be [uniform, gaussian]. Defaults to "uniform". |
| 477 | """ |
| 478 | super(Embedding, self).__init__() |
| 479 | self.input_dim = input_dim |
| 480 | self.output_dim = output_dim |
| 481 | self.initializer = initializer |
| 482 | |
| 483 | def initialize(self, x): |
| 484 | w_shape = (self.input_dim, self.output_dim) |