TFRecordWriter stuck (or very slow) while serializing data, depending on feature transformation type
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/62087">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/62087">No</a>

### Issue type

Bug

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

No

### Source

binary

### TensorFlow version

2.13

### Custom code

Yes

### OS platform and distribution

ubuntu 22.4

### Mobile device

_No response_

### Python version

3.8.9

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

11.8

### GPU model and memory

_No response_

### Current behavior?


**tf.io.TFRecordWriter** freeze when preprocessing features with **scikit-learn** (**Dask-ML**) **QuantileTranformer**, whereas its working (writing out few k samples within seconds) when using **StandardScaler**.

How might QuantileTransformer produce output data shaped in a way it breaks TFRecords serialization? Might dtype precision influence serialization performance in such criticality?

### Standalone code to reproduce the issue

```shell
(reduced pseudo code)

# fit scalers
#### NOTE Option 1: using this scaler breaks TF records writer!
feat_standardizer = dask_QuantileTransformer(output_distribution=standardizer_distribution, 
                                                n_quantiles=n_feat_standardizer_quantils, 
                                                subsample=n_fit_samples, copy=False)


# NOTE Option 2: Using this one works for TF records writer
feat_standardizer = dask_StandardScaler(copy=False)


## from here proceed the same way until TF data serialization as TFRecord files

x_train_future = dask_client.scatter(x_train_arr) 
feat_standardizer = dask_client.submit(feat_standardizer.fit, x_train_future).result()
x_train_preproc_future = dask_client.submit(feat_standardizer.transform, x_train_future)
x_train_dask_arr = dask_client.gather(x_train_preproc_future)

....

# Transform training data (in chuncks of subsets of the total training dataset)
X_train_future = dask_client.scatter(x_train_arr_transform_batch)
X_train_future = dask_client.submit(feat_standardizer.transform, X_train_future)
X_train_future = dask_client.submit(feat_normalizer.transform, X_train_future)
x_train_arr_transform_batch  = dask_client.gather(X_train_future)
    
# reshape features: (sample * time, feat) -> (sample, time, feat)
X_train = x_train_arr_transform_batch.reshape((n_train_samples, n_steps, n_feat))

# cast numpy default precision float64 -> TF float32                               
X_train = X_train.astype(np.float32)
y_train = y_train.astype(np.int64)

def array_to_tfrecords(X, y):
        feature_dict = {
            'X': tf.train.Feature(float_list=tf.train.FloatList(value=X.flatten())),
            'y': tf.train.Feature(int64_list=tf.train.Int64List(value=y.flatten()))
        }
        example = tf.train.Example(features=tf.train.Features(feature=feature_dict)) 
        return example.SerializeToString()

tf.io.TFRecordWriter(tfrecords_file_path, options=tf.io.TFRecordOptions(compression_type='ZLIB', compression_level=7)) as writer:
        for x, y in tqdm(zip(X_train, y_train)):         # <---- no progress visible here when using QuantileTransformer!
            serialized = array_to_tfrecords(x, y)
            writer.write(serialized)
```


### Relevant log output

```shell
No output visible. The script just never continues and freeze while pretending to serialize data
```
