// handles: history[..., k_e, i_b][k_b]
if k_b is not None:
items = [
_filter_none([_getitem(b, k_b) for b in batches])
if isinstance(batches, (list, tuple))
else _getitem(batches, k_b)
for batches in items
After Change
// extract epoch-level values, but only if not already done
// handles: history[..., k_e]
if (k_e is not None) and (i_b is None):
if not items:
raise KeyError(keyerror_msg.format(k_e))
extract = _get_getitem_method(items[0], k_e)
items = [extract(item, k_e) for item in items]
if not _filter_none(items):
raise KeyError(keyerror_msg.format(k_e))