code: def split_model_idx(model:nn.Module, idxs:Collection[int])->ModuleList:
      "Split `model` according to the indexes in `idxs`."
      layers = flatten_model(model)
      if idxs[0] != 0: idxs = [0] + idxs
      if idxs[-1] != len(layers): idxs.append(len(layers))
      return [nn.Sequential(*layers[i:j]) for i,j in zip(idxs[:-1],idxs[1:])f split_model_idx(model:nn.Module, idxs:Collection[int])->ModuleList:
      "Split `model` according to the indexes in `idxs`."
      layers = flatten_model(model)
      if idxs[0] != 0: idxs = [0] + idxs
      if idxs[-1] != len(layers): idxs.append(len(layers))
      return [nn.Sequential(*layers[i:j]) for i,j in zip(idxs[:-1],idxs[1:])]
docs: Split `model` according to the indexes in `idxs`.