# Example 2 ip_tensor=torch.rand(2,3) torch.unsqueeze(ip_tensor,2) # Output tensor([[[0.3670], [0.1786], [0.7115]], [[0.4241], [0.0422], [0.2277]]])