Different Behavior of tf.raw_ops.AdjustContrastV2 with jit_compile=True
Hi @**zoux1a** ,

I have replicated the reported behaviour with jit_compile=True and with jit_compile = False as well. It seems not related to the jit_compile issue. I attached a [gist](https://colab.research.google.com/gist/Venkat6871/0392c20a4f3fde08005a3b3e730895d9/62284_cpu-2-14-v.ipynb) for your reference.

Thank you! Hi @zoux1a ,

It seems there is precision related errors as you are casting float32 to float64. If I print overall result like converting the array to a number using `tf.reduce_sum()` then `tf.reduce_sum(tf.cast(no_op_res, tf.float64))` is equal to  `tf.reduce_sum(tf.cast(op_res, tf.float64)` in the tolerance level of 0.00001.

I have checked this assertion and its success.

```
tf.debugging.assert_near(
          tf.reduce_sum(tf.cast(no_op_res, tf.float64)), 
          tf.reduce_sum(tf.cast(op_res, tf.float64)), 
          atol=0.00001, 
          rtol=0.00001
)
```

This means the difference in results are just precision related or the order of elements might be different.But overall the result is same as described in the attached [gist-r1](https://colab.sandbox.google.com/gist/SuryanarayanaY/9116b42c582035936a6e4714feddd270/62284_r1.ipynb#scrollTo=lXqqISCFic5Y).

Thanks!
 Hi @zoux1a ,
I have debugged more into the issue and the root cause is the `contrast_factor` which you are using as random initializer and this value is different for both eager and graph execution. I have printed the same and you can observe both `contrast_factor` values are different in both cases which is causing the difference results but keeping the overall sum same.

If I pass a fixed `contrast_factor` say `0.2 `, the results are same with and without jit_compile. 

Please find the attached [gist-r2](https://colab.sandbox.google.com/gist/SuryanarayanaY/27fafcb8ef71957f59a9afc61446ef84/62284_r2.ipynb) for same excercise. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. 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/62284">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/62284">No</a>

### Issue type

Bug

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

No

### Source

source

### TensorFlow version

2.14.0

### Custom code

Yes

### OS platform and distribution

Ubuntu 22.04.3 LTS (x86_64)

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

11.8

### GPU model and memory

GPU 0: NVIDIA GeForce RTX 2070 GPU 1: NVIDIA GeForce RTX 2070 GPU 2: NVIDIA GeForce RTX 2070 GPU 3: NVIDIA GeForce RTX 2070

### Current behavior?

When the tf.raw_ops.AdjustContrastv2 operation is invoked within a tf.function with JIT compilation enabled (jit_compile=True), it produces different results compared to the same operation called without JIT compilation. This inconsistency is observed when the code is executed on a CPU device.

### Standalone code to reproduce the issue

```shell
import tensorflow as tf
import traceback

class Network(tf.Module):
    def __init__(self):
        super().__init__()

    @tf.function(jit_compile=True)
    def __call__(self, x):
      
      x = tf.raw_ops.AdjustContrastv2(images=x, contrast_factor=tf.random.normal([], dtype=tf.float32))               
      return x

m = Network()
inp = {
    "x": tf.random.normal([8, 8, 8], dtype=tf.float32),
    }

with tf.device('/CPU:0'):
    tf.config.run_functions_eagerly(True)
    no_op_res = m(**inp)
    tf.config.run_functions_eagerly(False)
    with tf.device('/CPU:0'):
        op_res = m(**inp)

    tf.debugging.assert_near(tf.cast(no_op_res, tf.float64), tf.cast(op_res, tf.float64), atol=0.001, rtol=0.001)
```


### Relevant log output

```shell
File "/home/guihuan/LLM/results/tf-2/2023-10-22-20-21/test.py", line 27, in <module>
    tf.debugging.assert_near(tf.cast(no_op_res, tf.float64), tf.cast(op_res, tf.float64), atol=0.001, rtol=0.001)
  File "/home/guihuan/.conda/envs/night/lib/python3.9/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/guihuan/.conda/envs/night/lib/python3.9/site-packages/tensorflow/python/ops/control_flow_assert.py", line 102, in Assert
    raise errors.InvalidArgumentError(
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected 'tf.Tensor(False, shape=(), dtype=bool)' to be true. Summarized data: b''
b'x and y not equal to tolerance rtol = tf.Tensor(0.001, shape=(), dtype=float64), atol = tf.Tensor(0.001, shape=(), dtype=float64)'
b'x (shape=(8, 8, 8) dtype=float64) = '
0.09821675717830658, -0.057733699679374695, 0.08248079568147659, ...
b'y (shape=(8, 8, 8) dtype=float64) = '
0.17769138514995575, -0.02411397360265255, 0.15723268687725067, ...
```
