1

I was trying to the understand basic Tensorflow functions in cifar10.py keras lib, function load_batch:

for i in range(1, 6):
    fpath = os.path.join(path, 'data_batch_' + str(i))
    (x_train[(i - 1) * 10000:i * 10000, :, :, :],
      y_train[(i - 1) * 10000:i * 10000]) = load_batch(fpath)

What does ":" mean in the line below?

x_train[(i - 1) * 10000:i * 10000, :, :, :]

1 Answers1

1

The x_train etc are numpy array or similar structure which implement their interface. Here you can read about slicing in numpy https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html

Or more generic about slicing in python https://docs.python.org/3.7/library/stdtypes.html#common-sequence-operations

Grzegorz Bokota
  • 1,736
  • 11
  • 19