code: def stats_options_updater_fn(
      stats_type: stats_options_util.StatsType,
      stats_options: tfdv.StatsOptions,
  ) -> tfdv.StatsOptions:
      """Update transform stats.
  
      This function is called by the Transform component before it computes
      pre-transform or post-transform statistics. It takes as input a stats_type,
      which indicates whether this call is intended for pre-transform or
      post-transform statistics. It also takes as argument the StatsOptions that
      are to be (optionally) modified before being passed onto TDFV.
  
      Args:
        stats_type: The type of statistics that are to be computed (pre-transform or
          post-transform).
        stats_options: The configuration to pass to TFDV for computing the desired
          statistics.
  
      Returns:
        An updated StatsOptions object.
      """
      if stats_type == stats_options_util.StatsType.POST_TRANSFORM:
          for f in stats_options.schema.feature:
              if f.name == _INPUT_WORD_IDS:
                  # Here we extend the schema for the input_word_ids feature to enable
                  # NLP statistics to be computed. We pass the vocabulary (_BERT_VOCAB)
                  # that was used in tokenizing this feature, key tokens of interest
                  # (e.g. "[CLS]",  "[PAD]", "[SEP]", "[UNK]") and key thresholds to
                  # validate. For more information on the field descriptions, see here:
                  # https://github.com/tensorflow/metadata/blob/master/
                  # tensorflow_metadata/proto/v0/schema.proto
                  text_format.Parse(
                      """
              vocabulary: "{vocab}"
              coverage: {{
                min_coverage: 1.0
                min_avg_token_length: 3.0
                excluded_string_tokens: ["[CLS]", "[PAD]", "[SEP]"]
                oov_string_tokens: ["[UNK]"]
               }}
               token_constraints {{
                 string_value: "[CLS]"
                 min_per_sequence: 1
                 max_per_sequence: 1
                 min_fraction_of_sequences: 1
                 max_fraction_of_sequences: 1
               }}
               token_constraints {{
                 string_value: "[PAD]"
                 min_per_sequence: 0
                 max_per_sequence: {max_pad_per_seq}
                 min_fraction_of_sequences: 0
                 max_fraction_of_sequences: 1
               }}
               token_constraints {{
                 string_value: "[SEP]"
                 min_per_sequence: 2
                 max_per_sequence: 2
                 min_fraction_of_sequences: 1
                 max_fraction_of_sequences: 1
               }}
               token_constraints {{
                 string_value: "[UNK]"
                 min_per_sequence: 0
                 max_per_sequence: {max_unk_per_seq}
                 min_fraction_of_sequences: 0
                 max_fraction_of_sequences: 1
               }}
              """.format(
                          vocab=_BERT_VOCAB,
                          max_pad_per_seq=_MAX_LEN
                          - 3,  # [CLS], 2x[SEP], Token
                          max_unk_per_seq=_MAX_LEN
                          - 4,  # [CLS], 2x[SEP]
                      ),
                      f.natural_language_domain,
                  )
      return stats_options
  
file_path: tfx/tfx/examples/bert/mrpc/bert_mrpc_utils.py
imports: from typing import List
  import tensorflow
  import tensorflow_data_validation
  import tensorflow_hub
  import tensorflow_transform
  from tfx import v1
  from tfx.components.transform import stats_options_util
  from tfx.examples.bert.utils.bert_models import build_and_compile_bert_classifier
  from tfx.examples.bert.utils.bert_tokenizer_utils import BertPreprocessor
  from tfx_bsl.public import tfxio
  from google.protobuf import text_format
label_desc: Use image node_id 3 for calling a global function with example usage: stats_options_updater_fn(stats_type, stats_options) and returns: stats_options