class_docstr: Shard the original huggingface model according to the policy
  
  Args:
      policy (:class:`Policy`): The policy to shard the model
      model (:class:`torch.Module`): The model to shard
      shard_config: The setting of distributed model
class_docstr_tok: ["Shard","the","original","huggingface","model","according","to","the","policy","Args",":","policy","(",":","class",":","`","Policy","`",")",":","The","policy","to","shard","the","model","model","(",":","class",":","`","torch.Module","`",")",":","The","model","to","shard","shard_config",":","The","setting","of","distributed","model"]
code: def _get_recursive_held_layers(
      self, held_layers: Optional[List[nn.Module]]
  ) -> Optional[List[nn.Module]]:
      def collect_sub_modules(module: nn.Module):
          if module is None:
              return
          recursive_held_layers.append(module)
          for name, child in module.named_children():
              collect_sub_modules(child)
  
      recursive_held_layers = []
      for module in held_layers:
          collect_sub_modules(module)
      return recursive_held_layers
  
imports: from types import MethodType
  from typing import Any, Callable, Dict, List, Optional, Set, Union
  import torch.nn
  from torch import Tensor
  from colossalai.lazy import LazyInitContext
  from .._utils import getattr_, setattr_
  from ..policies.auto_policy import get_autopolicy
  from ..policies.base_policy import Policy, SubModuleReplacementDescription
  from .shard_config import ShardConfig
  from .utils import set_tensors_to_none
label_desc: Use image node_id 11 for calling the ModelSharder obj's underlying member method code with example usage: obj._get_recursive_held_layers(held_layers) and returns: recursive_held_layers