def __init__(self, d_model, image_size, num_layers=6): super().__init__() self.d_model = d_model # la dimensió input es una per cada possible punt de control + 1 per inici de seq self._embedder = nn.Embedding(1+image_size*image_size, d_model) self._positional_encoder = PositionalEncoder(d_model) # decoder_layer with d_model, nhead, dim_feedforward (implementado tal cual en el paper) decoder_layer = nn.TransformerDecoderLayer(d_model, 8, 4*d_model) self._decoder = nn.TransformerDecoder(decoder_layer, num_layers=num_layers)
def __init__(self, d_model, num_layers=6): super().__init__() self.d_model = d_model # Instanciamos el embedder self._embedder = Embedder(d_model) # Positional Encoder self._positional_encoder = PositionalEncoder(d_model) # decoder_layer with d_model, nhead, dim_feedforward (implementado tal cual en el paper) decoder_layer = nn.TransformerDecoderLayer(d_model, 8, 4*d_model) self._decoder = nn.TransformerDecoder(decoder_layer, num_layers=num_layers)