For more clarity, I want to calculate the time complexity O of torch.cat and torch.stack through those examples
Example 1 concatenation by torch.cat:
import torch 
T1 = torch.Tensor([1,2,3,4]) 
T2 = torch.Tensor([0,3,4,1]) 
T3 = torch.Tensor([4,3,2,5]) 
T = torch.cat((T1,T2,T3)) 

Example 2 of torch.stack:
import torch 
T1 = torch.Tensor([1,2,3,4]) 
T2 = torch.Tensor([0,3,4,1]) 
T3 = torch.Tensor([4,3,2,5])  
T = torch.stack((T1,T2,T3))