def minibatch(data, minibatch_idx): return data[minibatch_idx] if isinstance(data, np.ndarray) else [data[i] for i in minibatch_idx]