code: def layer_auto_wrap_policy(
      module,
      recurse: bool,
      nonwrapped_numel: int,
      layer_cls: Union[nn.Module, Sequence[nn.Module]] = (
          SwinBlock,
          DeformableDetrTransformerEncoderLayer,
      ),
  ) -> bool:
      if recurse:
          # always recurse
          return True
      else:
          # if not recursing, decide whether we should wrap for
          # the leaf node or reminder
          return isinstance(module, tuple(layer_cls))
  
imports: from typing import Sequence, Union
  import torch.nn
  from mmdet.models.backbones.swin import SwinBlock
  from mmdet.models.layers.transformer.deformable_detr_layers import DeformableDetrTransformerEncoderLayer
label_desc: Use image node_id 1 for calling a global function with example usage: layer_auto_wrap_policy(module, recurse, nonwrapped_numel, layer_cls) and returns: True, isinstance