Пример #1
0
    def __init__(self, maximum_position=128, reducer=SumReducer()):
        """Initializes the position encoder.

    Args:
      maximum_position: The maximum position to embed. Positions greater
        than this value will be set to :obj:`maximum_position`.
      reducer: A :class:`opennmt.utils.reducer.Reducer` to merge inputs and
        position encodings.
    """
        super(PositionEmbedder, self).__init__(reducer=reducer)
        self.maximum_position = maximum_position
Пример #2
0
 def __init__(self, reducer=SumReducer()):
     self.reducer = reducer