How to achieve subtract and division in subtensor efficiently?

a = torch.Tensor([[1,3], [2,6], [4,5]])
I want to get the result:
temp = tensor([2, 4, 1]) where subtraction is performed along subtensor.
and final res = tensor([0.5, 0.5, 0.25, 0.25, 0.25, 0.25, 1.0]) where divided by 1 is performed on tensor temp.
How to do this in PyTorch efficiently?