Added infer_shape to TensorInv.