mini_batch_X = shuffled_X[:, k * mini_batch_size:(k 1) * mini_batch_size]
What is the semantics of the above line? what does the first colon mean?
CodePudding user response:
Colon in a slicing operation will generate slice(None, None, None)
, in numpy it means take all indices for this dimension
.
A slice is start:end:step
, usually step is omitted writing only start:end
, but you can also omit start :end
that will slice from beginning, or start:
that will end at the last index.