code: def laf_from_three_points(threepts: Tensor) -> Tensor:
      """Convert three points to local affine frame.
  
      Order is (0,0), (0, 1), (1, 0).
  
      Args:
          threepts: :math:`(B, N, 2, 3)`.
  
      Returns:
          laf :math:`(B, N, 2, 3)`.
      """
      laf = stack(
          [
              threepts[..., 0] - threepts[..., 2],
              threepts[..., 1] - threepts[..., 2],
              threepts[..., 2],
          ],
          dim=-1,
      )
      return laf
  
imports: import math
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from kornia.core import Tensor, concatenate, cos, sin, stack, tensor, zeros
  from kornia.core.check import KORNIA_CHECK_LAF, KORNIA_CHECK_SHAPE
  from kornia.geometry.conversions import angle_to_rotation_matrix, convert_points_from_homogeneous, rad2deg
  from kornia.geometry.linalg import transform_points
  from kornia.geometry.transform import pyrdown
label_desc: Use image node_id 19 for calling a global function with example usage: laf_from_three_points(threepts) and returns: laf