All input tensors must have the same rank. [Op:MatrixSolve]
@alejopaullier96,
Could you please provide the simple standalone code to reproduce the issue which helps us to analyse the issue in an effective way. 

The error is clearly describing that the error is due to shape or Rank. 

matrix | A Tensor. Must be one of the following types: float64, float32, half, complex64, complex128. Shape is [..., M, M].
rhs | A Tensor. Must have the same type as matrix. Shape is [..., M, K].

https://www.tensorflow.org/api_docs/python/tf/linalg/solve#args


Thank you! Hi, is this open to pick up, I would like to contribute to this. I am new to open source contribution, but I am a quick learner.
 @tilakrayal I have solved the issue by squeezing one dimension from the first input tensor:
```
M = tf.squeeze(M, axis=1)
```
This way my first tensor `M` which had shape `(batch_size, 1, 4, 4)` after squeezing has shape `(batch_size, 4, 4)`.  My second tensor `E` had shape `(batch_size, 4, 1)`, so essentially they ended up with the same number of dimensions (3). 

Just for clarification, the current documentation does not specify that the two input tensors/matrices must have the same number of dimensions, but rather that it specifies how the two last dimensions must be. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60721">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60721">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

tf 2.11.0

### Custom Code

Yes

### OS Platform and Distribution

Linux

### Mobile device

_No response_

### Python version

3.10.10

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

I have two tensors `M` and `E` of shapes `(batch_size, 1, 4, 4)` and `(batch_size, 4, 1)` respectively. The official documentation of [tf.linalg.solve](https://www.tensorflow.org/api_docs/python/tf/linalg/solve) states the two tensors should have shapes `(..., M,M)` and `(...,M,K)`.  After executing my code I get the following error:
```
InvalidArgumentError: {{function_node __wrapped__MatrixSolve_device_/job:localhost/replica:0/task:0/device:CPU:0}} All input tensors must have the same rank. [Op:MatrixSolve]
```

### Standalone code to reproduce the issue

```shell
S = tf.linalg.solve(M, E)
```
```


### Relevant log output

_No response_</details>