code: def test_model_predict(nlp, docs, trf_model):
      outputs = trf_model.predict(docs)
      shape = outputs.model_output.last_hidden_state.shape
      if trf_model.transformer.config.output_attentions is True:
          assert outputs.model_output.attentions is not None
          assert all(
              [
                  t.shape[0] == shape[0]
                  for t in outputs.model_output.attentions
              ]
          )
      else:
          assert outputs.model_output.attentions is None
      if trf_model.transformer.config.output_hidden_states is True:
          assert outputs.model_output.hidden_states is not None
          assert all(
              [
                  t.shape[0] == shape[0]
                  for t in outputs.model_output.hidden_states
              ]
          )
      else:
          assert outputs.model_output.hidden_states is None
      assert isinstance(outputs, FullTransformerBatch)
  
      # for a fast tokenizer check that all non-special wordpieces are aligned
      # (which is not necessarily true for the slow tokenizers)
      if trf_model.tokenizer.is_fast:
          outputs = trf_model.predict([nlp.make_doc("\tÁaaa  \n\n")])
          aligned_wps = outputs.align.data.flatten()
          for i in range(len(outputs.wordpieces.strings[0])):
              if (
                  outputs.wordpieces.strings[0][i]
                  not in trf_model.tokenizer.all_special_tokens
              ):
                  assert i in aligned_wps
  
file_path: spacy-transformers/spacy_transformers/tests/test_model_wrapper.py
imports: import pytest
  import spacy
  from thinc.api import Model
  from ..layers import TransformerModel
  from ..data_classes import FullTransformerBatch
  from ..span_getters import get_doc_spans
label_desc: Use image node_id 8 for calling a global function with example usage: test_model_predict(nlp, docs, trf_model) without return types