From my search already i found that MultiLabelMarginLoss might be the suitable loss function for me.
def train_epoch(_epoch, dataloader, model, loss_function):
# switch to train mode -> enable regularization layers, such as Dropout
model.train()
running_loss = 0.0
for i_batch, sample_batched in enumerate(dataloader, 1):

    # get the inputs (batch)
    inputs, labels, lengths, indices = sample_batched

    # sort batch (for handling inputs of variable length)
    lengths, (inputs, labels) = sort_batch(lengths, (inputs, labels))

    # convert to CUDA Variables
    if torch.cuda.is_available():
        inputs = Variable(inputs.cuda())
        labels = Variable(labels.cuda())
        lengths = Variable(lengths.cuda())

    # 1 - zero the gradients
    optimizer.zero_grad()

    # 2 - forward pass: compute predicted y by passing x to the model
    outputs = model(inputs, lengths)
    # 3 - compute loss
    loss = loss_function(outputs, labels)

    # 4 - backward pass: compute gradient wrt model parameters
    loss.backward()

    # 5 - update weights
    optimizer.step()

    running_loss += loss.data[0]

    # print statistics
    progress(loss=loss.data[0],
             epoch=_epoch,
             batch=i_batch,
             batch_size=BATCH_SIZE,
             dataset_size=len(train_set))

I guess i have to modify somehow the outputs to not produce continuous values when i want to predict the labels.