Colab crashes after torch.cat

I’m just wondering why colab notebook crashes after running this code:

torch.cat( [torch.mean(torch.tensor([1.])), torch.mean(torch.tensor([1.]))])

Can someone help with this ?

This is because mean will implicitly reduce the first dimension and produce a tensor (really a scalar) without dimensions and cat expects at least a single dimension.
You can work around this with

torch.cat( [torch.mean(torch.tensor([1.]), dim=0, keepdim=True), torch.mean(torch.tensor([1.]), dim=0, keepdim=True)])