Aborted (core dumped) with tf.raw_ops.AvgPoolGrad
@sachinprasadhs I was able to replicate the error reported [here](https://colab.research.google.com/gist/sushreebarsa/fa1b2962c80219519380bfebc99f9879/63353.ipynb). Thank you!
### Issue type

Bug

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

Yes

### Source

binary

### TensorFlow version

tf 2.15

### Custom code

Yes

### OS platform and distribution

Ubuntu 20.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

core dumped error with specific input parameters.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf

# Generate input data
input_data = tf.random.normal([1, 28, 28, 3])
grad = tf.random.normal([1, 14, 14, 6])  # Change the number of channels in grad tensor

# Perform average pooling
result = tf.nn.avg_pool2d(input_data, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID', data_format='NHWC')

# Compute gradient
grad_result = tf.raw_ops.AvgPoolGrad(orig_input_shape=tf.shape(input_data), grad=grad, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID', data_format='NHWC')

print(grad_result)
```


### Relevant log output

```shell
free(): corrupted unsorted chunks
Aborted (core dumped)
```
