inf outputs with an OpenCL delegate for a pattern with a sequence of Dense/FullyConnected layers
@MinaBabahaji-ML,
Thank you for the issue. Could you please provide the complete error log which helps to analyse and debug the root cause of the issue. Thank you! Sure, this is the complete log message:
```
INFO: Created TensorFlow Lite delegate for GPU.
INFO: Initialized TensorFlow Lite runtime.
VERBOSE: Replacing 20 out of 20 node(s) with delegate (TfLiteGpuDelegateV2) node, yielding 1 partitions for the whole graph.
INFO: Initialized OpenCL-based API.
INFO: Created 1 GPU delegate kernels.
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
VERBOSE: Replacing 20 out of 20 node(s) with delegate (TfLiteXNNPackDelegate) node, yielding 1 partitions for the whole graph.
OpenCL output:
-32560, -39104, -48128, 24512, -inf, -9808, -inf, -41344, -22960, -54048, -49792, -inf, inf, -1512, -inf, -28368, -inf, -inf, -9864, -14296, -inf, 863, -11792, -48832, -inf, -51040, -20864, -32176, -inf, -10928, -26560, -inf, -21344, -inf, -41632, -22544, -60128, -44832, -37856, -37152, 21216, -inf, -38304, -inf, -15312, 17344, -inf, -18816, -40960, -14112, -44416, -7144, 25568, 18880, -54496, -50400, -23456, -18336, -31072, -inf, inf, -13680, -inf, 784, -52544, -19488, -37856, 36224, -50880, -14416, -13944, -inf, -37952, -41856, 3120, -50176, -38272, -45728, -inf, 9872, -inf, -52768, -40512, -inf, -57664, -64192, inf, -61120, -inf, 11736, -inf, -29488, -35200, -inf, -inf, -inf, -36288, -inf, -43648, -inf, -inf, -14968, -50624, -15208, -inf, 8320, -21344, -65472, 51008, -18768, inf, -9824, -32832, 15624, 14648, -37280, -34688, 42432, -19264, -22688, inf, -34, -32896, -inf, -46272, -62176, -50848, -29344, -inf, 9248, -2568, 16152, -22912, -28880, -4408, -17696, inf, -17632, 32960, -1622, -41536, -36928, -inf, -31872, -62080, -inf, -47296, -inf, -54336, -63904, -35776, 32064, -623.5, -inf, -2802, -46464, -inf, -inf, -inf, -17408, -63360, -10992, -inf, -28960, -56256, -33152, -16296, -inf, 1054, 27456, -57312, -17760, -29312, -50368, -7928, -38368, inf, -inf, -33376, -57664, -20592, 1857, 96, -50560, -11512, -936, 808, -10944, 10376, -44736, -23456, -36320, -51392, -inf, -25760, 14320, -inf, 2280, -52928, -18944, -24928, 3820, -63776, 13120, 17712, -60416, -inf, 10096, -26656, -46688, inf, -3528, -22256, -30512, -61728, 3274, -16232, -18912, -39552, -15896, 1952, -57280, 45216, -3566, -10440, -inf, -18320, -2868, -40800, -29600, -20640, -52928, -inf, 4104, -160, -46240, -32800, -51392, -inf, -inf, 480, -34208, -inf, -5936, -49376, -11184, -37312, 18464, 9872, 20816, 62240, inf, -35360, -12288, -18624, -25728, -23328, 18128, -4580, -inf, 1204, -inf, -52384, -20416, -24928, -22832, -48224, -inf, -8328, -inf, 35168, -53440, -52512, -29024, -39264, -28992, 7340, -5240, -4692, -inf, -60384, 9720, -12272, -47616, -20128, -28832, -10816, -36096, -28944, -31872, -34624, -48000, -inf, -18336, inf, -11232, -22880, -49632, -22400, -inf, 11888, -31712, -29312, -44512, -10112, -49440, -20736, -45088, -30080, -inf, -18624, -15440, -14032, -22080, -4492, -43776, -43456, -inf, -39520, -8040, -16256, -49472, -inf, 480, -38496, -inf, -29920, -33696, -inf, -13808, -inf, -4096, -44480, -inf, -41920, -27280, 8424, -18800, -31120, 20352, -14320, -34336, inf, -22208, -inf, -11120, -38048, -inf, -29584, -17728, 2448, 8904, -40384, -32672, inf, -25312, -19904, -62272, -53216, -21472, -5024, 14048, -inf, -53568, -24832, 12704, 21696, -15600, -inf, -35840, -7208, -52160, 7224, 23984, -inf, -55680, -22816, -313, -19280, -inf, -29952, -57024, -12320, -57056, -32000, inf, 264, -15184, -25824, -12704, inf, 5488, -48128, -34592, 16864, -27840, -inf, inf, -21056, -30432, -63104, -32864, -52480, -29728, -14736, -53088, -inf, -5648, -51648, -12912, -17392, -22880, -inf, -24944, -inf, -35616, -18272, 2776, 33536, -inf, 13592, -56032, -38976, -inf, -36320, -inf, -15936, -5452, -12832, inf, 2688, -inf, -inf, -45696, 4600, 10560, 39840, -44928, -24480, -15496, -13728, -23840, -8152, inf, 44800, -50112, -34816, -45248, 4348, -60672, -inf, -38912, -24640, 45376, -43008, -inf, -22592, -inf, -49024, -8752, -26368, -59520, -inf, inf, -19232, -26976, 6864, -inf, -inf, -10544, 2048, -54144, 12688, -14896, -52352, -28672, -6476, -inf, -22304, -50272, -572, -inf, -63136, -32368, -29088, -inf, -20592, 38272, -32928, -1964, 6436, -63232, -49216, inf, -inf, -46144, 8664, -16736, -6252, -10080, -37344, -inf, -40224, -9184, -63232, 31040, 48512, -inf, -25936, -16960, -38400, -inf, 
``` Hi @MinaBabahaji-ML, in attempting to reproduce your issue I ran into this issue:

```
adb shell "cd /data/local/tmp && LD_LIBRARY_PATH=. ./model_test --model=model_files/sample.tflite --input_shape=1,105 --output_shape=1,512"
CANNOT LINK EXECUTABLE "./model_test": library "libc++_shared.so" not found: needed by main executable
```

I'm using an emulator and NDK=25.2.9519653. Are we missing some steps?

Thanks for your help. Hello @pkgoogle . I added `libc++_shared.so` to the tensorflow_lite_c_2_15_0 package, and please push it to the device with  `adb push ./tensorflow_lite_c_2_15_0/lib/aarch64/libc++_shared.so /data/local/tmp` . I also added this to the build instructions. However, I am afraid you may not be able to regenerate the problem with an emulator. I tested it on a Galaxy S20 device.  HI @MinaBabahaji-ML, I was able to continue with the new instructions but am running into a different issue probably due to using an emulator.

Hi @sirakiin, can you please take a look? Thanks.
 Hi @MinaBabahaji-ML, I already commented on [AI-Edge-Torch](https://github.com/google-ai-edge/ai-edge-torch), on your other issue. Can you try this out with this script and let us know if it resolves your issue.... you may need to train a bit to get reasonable outputs.

```py
import torch
import torch.nn as nn
import torch.nn.functional as F
import ai_edge_torch


class FCResidualBlock(nn.Module):
    def __init__(self):
        super().__init__()
        self.dense1 = nn.Linear(105, 512)
        self.dense2 = nn.Linear(512, 512)
        self.dense3 = nn.Linear(512, 512)
        self.dense4 = nn.Linear(512, 512)
        self.dense5 = nn.Linear(512, 512)

    def forward(self, x):
        x = self.dense1(x)
        y = F.dropout(F.relu(self.dense2(x)), p=0.2)
        y = F.dropout(F.relu(self.dense3(y)), p=0.2)
        x = x + y
        x = F.dropout(F.relu(self.dense4(x)), p=0.2)
        return self.dense5(x)


model = FCResidualBlock()
sample_inputs = (torch.randn(1, 105),)

edge_model = ai_edge_torch.convert(model.eval(), sample_inputs)
edge_model.export("fc_res_block.tflite")
```
### Issue Summary:
When running a TensorFlow Lite model ( a sequence of Dense/FullyConnected layers) on an Android 13 device with TensorFlow version 2.15 built from source, using the OpenCL delegate, I am experiencing 'inf' outputs. This issue can't be reproduced with the XNNPACK delegate. The model is shared in the github repository. 
![image](https://github.com/tensorflow/tensorflow/assets/118396522/4b561a0b-5f19-4d98-917d-3b5e259ee491)

### 1. System information

- Android 13
- TensorFlow version 2.15 built from source

### 2. Code
I did not encounter any issues in converting the model, but when running it on the phone with the OpenCL delegate, I am consistently getting 'inf' outputs. The code and steps to reproduce the problem can be found in the following GitHub repository:
[GitHub Repository Link](https://github.com/MinaBabahaji-ML/GPU_problem.git)


### 3. logs:
INFO: Created TensorFlow Lite delegate for GPU.
INFO: Initialized TensorFlow Lite runtime.
... (other log entries)
inf, -25936, -16960, -38400, -inf,

