code: def test_apply_alignment(nested_align, X_cols):
      ops = NumpyOps()
      align = get_ragged(ops, nested_align)
      X_shape = (align.data.max() + 1, X_cols)
      X = ops.alloc2f(*X_shape)
      Y, get_dX = apply_alignment(ops, align, X)
      assert isinstance(Y, Ragged)
      assert Y.data.shape[0] == align.data.shape[0]
      assert Y.lengths.shape[0] == len(nested_align)
      dX = get_dX(Y)
      assert dX.shape == X.shape
  
file_path: spacy-transformers/spacy_transformers/tests/test_alignment.py
imports: import pytest
  from typing import List
  import numpy
  from spacy.tokens import Doc
  from spacy.vocab import Vocab
  from thinc.api import NumpyOps
  from thinc.types import Ragged
  from ..align import get_alignment, apply_alignment
  from ..align import get_span2wp_from_offset_mapping
label_desc: Use image node_id 5 for calling a global function with example usage: test_apply_alignment(nested_align, X_cols) without return types