code: def crop_affine_mat(
      from_start, from_end, to_start, to_end, absolute=False
  ):
      from_start, from_end, to_start, to_end = (
          np.array(x)
          for x in expand_dims(from_start, from_end, to_start, to_end)
      )
      if absolute:
          from_start, from_end = np.minimum(
              from_start, from_end
          ), np.maximum(from_start, from_end)
          to_start, to_end = np.minimum(to_start, to_end), np.maximum(
              to_start, to_end
          )
  
      scale = (to_end - to_start) / (from_end - from_start)
      T1 = translate_affine_mat(-from_start)
      S = scale_affine_mat(scale)
      T2 = translate_affine_mat(to_start)
      affine_mat = np.dot(T2, np.dot(S, T1))
      return affine_mat
  
imports: import random
  import warnings
  import numpy
  from scipy.spatial.transform import Rotation
  from nvidia.dali.pipeline import Pipeline
  import nvidia.dali.ops.transforms
  import nvidia.dali.ops
  import nvidia.dali.fn
  from nvidia.dali import pipeline_def
  from sequences_test_utils import ArgData, ArgDesc, sequence_suite_helper, ArgCb, ParamsProvider
  from nose_utils import assert_raises
label_desc: Use image node_id 19 for calling a global function with example usage: crop_affine_mat(from_start, from_end, to_start, to_end, absolute) and returns: affine_mat