I don’t know why this happened but I’ve had imported tensorflow but wasn’t using it. I deleted it and now the code works!! :)))  but
torch.stack(target['a'], dim=2)
print(type(target['a']))

and
torch.cat(target['a'])
print(type(target['a']))

give me

<class ‘list’>

I don’t know what is happening.