Something like this should work
encoder = Encoder()
decoder = Decoder()
clustering_head = nn.Linear(1152, count_soft_labels)

for data, soft_labels in training_data:
    datav = Variable(data)
    labelsv = Variable(soft_labels)
    encoded = encoder(datav)
    decoded = decoder(encoded)
    pred_labels = clustering_head(encoded)
    loss = reconstruction_loss_fn(data, decoded) + clustering_loss(pred_labels, labelsv)