XLA compiled `tf.matmul` can work for two size-incompatible matrices
Any progress on this issue？ @sachinprasadhs,
I was able to reproduce the issue on tensorflow v2.12, v2.13 and tf-nightly. Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/8b36e72bb2c1522665716df44450d82e/untitled1375.ipynb).
### Issue type

Bug

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

2.15.0-dev20230914

### 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

_No response_

### GPU model and memory

_No response_

### Current behavior?

XLA compiled `tf.matmul` can work for two size-incompatible matrices, like `[1, 5]` and `[10, 1]`. By contrast, if we run `tf.matmul` directly without XLA compilation, it will raise the error as expected: `Matrix size-incompatible: In[0]: [1,5], In[1]: [10,1] [Op:BatchMatMulV2] name: `

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
"""
With XLA
"""
class Model(tf.keras.Model):
  def __init__(self):
    super(Model, self).__init__()
    self.w = tf.Variable(tf.random.normal([10,1]),
            shape=tf.TensorShape(None),
            dtype='float32')
  @tf.function(jit_compile=True)
  def call(self, x):
    return tf.matmul(x, self.w)

m = Model()

# Inputs to the model
x1 = tf.constant([1., 2., 3., -3., 2.5], shape=[1, 5])
print(m(x1))
# tf.Tensor([[-11.37509]], shape=(1, 1), dtype=float32)

"""
Without XLA
"""
class Model(tf.keras.Model):
  def __init__(self):
    super(Model, self).__init__()
    self.w = tf.Variable(tf.random.normal([10,1]),
            shape=tf.TensorShape(None),
            dtype='float32')

  def call(self, x):
    return tf.matmul(x, self.w)

m = Model()

# Inputs to the model
x1 = tf.constant([1., 2., 3., -3., 2.5], shape=[1, 5])
print(m(x1))
"""
InvalidArgumentError: Exception encountered when calling layer 'model' (type Model).

{{function_node __wrapped__BatchMatMulV2_device_/job:localhost/replica:0/task:0/device:GPU:0}} Matrix size-incompatible: In[0]: [1,5], In[1]: [10,1] [Op:BatchMatMulV2] name: 

Call arguments received by layer 'model' (type Model):
  • x=tf.Tensor(shape=(1, 5), dtype=float32)
"""
```


### Relevant log output

_No response_