code: def test_masking(self):
      # 测试crf的pad masking正常运行
      import torch
      from fastNLP.modules.torch.decoder.crf import (
          ConditionalRandomField,
      )
  
      max_len = 5
      n_tags = 5
      pad_len = 5
  
      torch.manual_seed(4)
      logit = torch.rand(1, max_len + pad_len, n_tags)
      # logit[0, -1, :] = 0.0
      mask = torch.ones(1, max_len + pad_len)
      mask[0, -pad_len] = 0
      model = ConditionalRandomField(n_tags)
      pred, score = model.viterbi_decode(
          logit[:, :-pad_len], mask[:, :-pad_len]
      )
      mask_pred, mask_score = model.viterbi_decode(logit, mask)
      assert pred[0].tolist() == mask_pred[0, :-pad_len].tolist()
  
file_path: fastNLP/tests/modules/torch/decoder/test_CRF.py
imports: import pytest
  import os
  from fastNLP import Vocabulary
label_desc: Use image node_id 6 for calling the TestCRF obj's underlying member method code with example usage: obj.test_masking() without return types