Fixed infer_shape method for tensorinv and added its tests.