I am trying to fill my numpy array with training labels. Say k = 0 and size = 3, k = 1 and size = 3, The result should look like: np.array([0], [0], [0], [1], [1], [1])

Now this code works:

```
np.array([0]*size1, [1]*size2, ...)

```

But this does not work:

```
train_labels = np.array([k]*size for k, size in enumerate(train_sizes))

```

When I call keras.utils.to\_categorical like:

```
train_labels = keras.utils.to_categorical(train_labels, num_classes = class_size)

```

It would give me the following error:

```
TypeError: long() argument must be a string or a number, not 'generator'

```

Can someone please help me with this? Thanks!