Repository: tensorflow
Issue: tf.linalg.matrix_rank  results has different results with or without @tf.function for numpy inputs under tensorflow-cpu
Labels: stat:awaiting tensorflower,type:bug,comp:apis,comp:tf.function

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

source

### Tensorflow Version

2.14.0-dev20230509

### Custom Code

Yes

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

N/A

### GPU model and memory

_No response_

### Current Behaviour?

`tf.linalg.matrix_rank` has different results with or without `@tf.function` when the input is a numpy tensor and **tensorFlow-cpu** is used. 

Interestingly, this issue does not occur when the numpy array is explicitly converted to a TensorFlow tensor before being passed as an argument to tf.linalg.matrix_rank. This explicit conversion shouldn't be necessary, as per the TensorFlow tutorial (https://www.tensorflow.org/tutorials/customization/basics#:~:text=TensorFlow%20operations%20automatically%20convert%20NumPy%20ndarrays%20to%20Tensors), which states that "TensorFlow operations automatically convert NumPy ndarrays to Tensors". This discrepancy seems to indicate a bug that prevents the utilization of this automatic conversion feature.

This issue was previously raised and discussed under issue (#57959), where the proposed solution was the explicit conversion of numpy arrays to TensorFlow tensors. While this solution works, it does not align with the functionality of TensorFlow's automatic conversion of numpy arrays to tensors, and it requires users to perform an additional step that should not be necessary.

In essence, this bug seems to affect the user's ability to leverage TensorFlow's automatic conversion of numpy arrays to tensors, particularly when using TensorFlow-CPU.

I open this issue because the same behavior still exists in the latest nightly version and I believe it should not be a user issue according to the tutorial.

The reproduction colab link is here: https://colab.research.google.com/drive/1wEYxe5b-m7_3pqBP1iTrjSvydMd_jD_B?usp=sharing. 

### Standalone code to reproduce the issue

```shell
import numpy as np
import tensorflow as tf

print(tf.__version__)

input = {'name': 'matrix_rank', 'a': np.array([[-7.24721292e+307,  4.66389010e+307, -5.40181227e+307,
         7.28793100e+307,  5.19885794e+307],
       [-5.74381106e+307,  2.21923437e+307,  4.96898538e+307,
         4.26402766e+307,  7.42174751e+307],
       [-2.62810171e+307,  1.71425915e+307, -6.99349881e+307,
        -8.11519519e+307,  4.04358640e+307],
       [-8.52726304e+307,  1.44214314e+307, -4.53927548e+307,
        -4.79571993e+307, -4.59672928e+307]])}
print(input['a'].dtype)

output1 = tf.linalg.matrix_rank(**input)
print(output1)

@tf.function
def fun_wrapper(x):
    return tf.linalg.matrix_rank(**x)

output2 = fun_wrapper(input)
print(output2)
```


### Relevant log output

```shell
2.14.0-dev20230509
float64
tf.Tensor(0, shape=(), dtype=int32)
tf.Tensor(4, shape=(), dtype=int32)
```
</details>