Could you post the code of your Dataset implementation?
It seems you would like to return both the data and target as one tensor?
The usual approach would be to return these tensors separately, as they might have a different number of dimensions and shapes:
def __getitem__(self, index):
    ...
    return data, target