class_docstr: Utilities to freeze/unfreeze layers.
  
  Args:
      model:
          a model with weights.
  Return:
      LayerFreezer.
  
  Example:
      >>> from towhee.trainer.utils.layer_freezer import LayerFreezer
      >>> from towhee.models import vit
      >>> my_model = vit.create_model()
      >>> my_freezer = LayerFreezer(my_model)
      >>> # Check if modules in the last layer are frozen
      >>> my_freezer.status(-1)
      >>> # Check if modules in the layer "head" are frozen
      >>> my_freezer.status("head")
      ['unfrozen', 'unfrozen']
      >>> # Show all frozen layers
      >>> my_freezer.show_frozen_layers()
      ['patch_embed', 'head']
      >>> # Freeze layers by a list of layer indexes
      >>> my_freezer.by_idx([0, -1])
      >>> # Freeze layers by a list of layer names
      >>> my_freezer.by_names(['head'])
      >>> # Freeze all layers
      >>> my_freezer.set_all()
      >>> # Unfreeze all layers
      >>> my_freezer.set_all(freeze=False)
      >>> # Freeze all except the last layer
      >>> my_freezer.set_slice(-1)
docstr: Show all names of frozen layers
  
  Args:
      None.
  Return:
      A list of names of frozen layers
code: def show_frozen_layers(self):
      """
      Show all names of frozen layers
  
      Args:
          None.
      Return:
          A list of names of frozen layers
      """
      outs = []
      for name, layer in self.model.named_children():
          flag = 0
          for param in layer.parameters():
              if not param.requires_grad:
                  flag = 1
          if flag == 1:
              outs.append(name)
      # print(f'{len(outs)} frozen layers (names): {outs}')
      return outs
  
file_path: towhee/towhee/trainer/utils/layer_freezer.py
imports: from typing import Union
label_desc: Use image node_id 3 for calling the LayerFreezer obj's underlying member method code with example usage: obj.show_frozen_layers() and returns: outs