code: def freeze_regex(self, pattern):
      unfrozen_names = []
      for name, param in self.named_parameters():
          if re.fullmatch(pattern, name) is not None:
              param.requires_grad_(False)
          else:
              unfrozen_names.append(name)
  
imports: import contextlib
  import copy
  import logging
  import math
  import re
  from argparse import Namespace
  from dataclasses import dataclass, field
  from typing import Any, Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from omegaconf import II, MISSING, open_dict
  from fairseq import checkpoint_utils, tasks, utils
  from fairseq.dataclass import FairseqDataclass
  from fairseq.dataclass.utils import convert_namespace_to_omegaconf
  from fairseq.models import BaseFairseqModel, FairseqEncoder, FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model
  from fairseq.models.wav2vec.wav2vec2 import MASKING_DISTRIBUTION_CHOICES, LAYER_TYPE_CHOICES, AdapterFast
  from fairseq.modules import LayerNorm, PositionalEmbedding, TransformerDecoderLayer
  from fairseq.tasks import FairseqTask
label_desc: Use image node_id 2 for calling the Wav2VecEncoder obj's underlying member method code with example usage: obj.freeze_regex(pattern) without return types