def _slice_entry(self, entry, index: slice):
    if isinstance(entry, dict):
        return {k: self._slice_entry(v, index) for (k, v) in entry.items()}
    if isinstance(entry, tuple):
        return new_tuple(type(entry), (self._slice_entry(e, index) for e in entry))
    elif isinstance(entry, (to.Tensor, np.ndarray)):
        return entry[(index, ...)]
    elif isinstance(entry, list):
        return entry[index]
    else:
        return None
def _slice_entry(self, entry, index: slice):
    if isinstance(entry, dict):
        return {k: self._slice_entry(v, index) for (k, v) in entry.items()}
    if isinstance(entry, tuple):
        return new_tuple(type(entry), (self._slice_entry(e, index) for e in entry))
    elif isinstance(entry, (to.Tensor, np.ndarray)):
        return entry[(index, ...)]
    elif isinstance(entry, list):
        return entry[index]
    else:
        return None