code: def forward(model: TransformerListener, docs, is_train):
      if is_train:
          # This might occur during training when the transformer layer is frozen / hasn't been updated.
          # In that case, it should be set to "annotating" so we can retrieve the embeddings from the doc.
          if model._batch_id is None:
              outputs = []
              for doc in docs:
                  if doc._.trf_data is None:
                      raise ValueError(
                          Errors.E203.format(name="transformer")
                      )
                  else:
                      outputs.append(doc._.trf_data)
              return outputs, _empty_backprop
          else:
              model.verify_inputs(docs)
              return model._outputs, model.backprop_and_clear
      else:
          width = model.get_dim("nO")
          outputs = []
          for doc in docs:
              if doc._.trf_data is None:
                  outputs.append(
                      TransformerData.zeros(
                          len(doc), width, xp=model.ops.xp
                      )
                  )
              else:
                  outputs.append(doc._.trf_data)
          return outputs, _empty_backprop
  
file_path: spacy-transformers/spacy_transformers/layers/listener.py
imports: from typing import Optional, Callable, List
  from thinc.api import Model
  from spacy.errors import Errors
  from spacy.tokens import Doc
  from ..data_classes import TransformerData
label_desc: Use image node_id 1 for calling a global function with example usage: forward(model, docs, is_train) and returns: outputs,  _empty_backprop, outputs,  _empty_backprop, model,  model