Then you need to replace the addition with a .sum(-1) and the division by t.select(-1, -1)/t.select(-1, 0).
If you want a single Tensor for the output, you can use torch.stack([r, theta], -1) to get an output of size [21, 2].