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
def __init__(self, reducer=SumReducer()): self.reducer = reducer