Dataset sharding warning
@andremfreitas Could you please provide a standalone code to replicate the issue reported here as it would help us to analyze the issue?
Thank you! 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/66851">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/66851">No</a>

### Issue type

Support

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

Yes

### Source

source

### TensorFlow version

2.16

### Custom code

Yes

### OS platform and distribution

Linux Ubuntu 22.04.3 LTS

### Mobile device

_No response_

### Python version

3.10

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

A100 40GB

### Current behavior?

Hi,

I am using a mirrored strategy for gpu parallelisation. This is how I prepare my dataset:
```
data = tf.data.Dataset.from_tensor_slices(gt_reshaped).batch(batch_size = batch_size).shuffle(buffer_size = n_ics)
dist_dataset = strategy.experimental_distribute_dataset(data)
```

Which is resulting in the warning below (see relevant log output). 
This (closed) issue mentions something similar: [#42146](https://github.com/tensorflow/tensorflow/issues/42146). I would expect this warning not to appear in tf2.16 anymore. I am not trying to do data sharding of a a file or files so this warning shouldn't be thrown in my opinion (and it's annoying). But please let me know if it makes sense to be thrown in a case like this.

Thanks,
Andre



### Standalone code to reproduce the issue

```shell
Cannot produce a MWE at the moment.
```


### Relevant log output

```shell
2024-05-02 17:21:33.678068: W tensorflow/core/grappler/optimizers/data/auto_shard.cc:766] AUTO sharding policy will apply DATA sharding policy as it failed to apply FILE sharding policy because of the following reason: Found an unshardable source dataset: name: "TensorSliceDataset/_1"
op: "TensorSliceDataset"
input: "Placeholder/_0"
attr {
  key: "Toutput_types"
  value {
    list {
      type: DT_COMPLEX128
    }
  }
}
attr {
  key: "_cardinality"
  value {
    i: 2560000
  }
}
attr {
  key: "is_files"
  value {
    b: false
  }
}
attr {
  key: "metadata"
  value {
    s: "\n\024TensorSliceDataset:0"
  }
}
attr {
  key: "output_shapes"
  value {
    list {
      shape {
        dim {
          size: 10
        }
        dim {
          size: 2
        }
      }
    }
  }
}
```
