code: def _angle_from_tan(
      axis: str,
      other_axis: str,
      data,
      horizontal: bool,
      tait_bryan: bool,
  ) -> torch.Tensor:
      """
      Extract the first or third Euler angle from the two members of
      the matrix which are positive constant times its sine and cosine.
  
      Args:
          axis: Axis label "X" or "Y or "Z" for the angle we are finding.
          other_axis: Axis label "X" or "Y or "Z" for the middle axis in the
              convention.
          data: Rotation matrices as tensor of shape (..., 3, 3).
          horizontal: Whether we are looking for the angle for the third axis,
              which means the relevant entries are in the same row of the
              rotation matrix. If not, they are in the same column.
          tait_bryan: Whether the first and third axes in the convention differ.
  
      Returns:
          Euler Angles in radians for each matrix in data as a tensor
          of shape (...).
      """
  
      i1, i2 = {"X": (2, 1), "Y": (0, 2), "Z": (1, 0)}[axis]
      if horizontal:
          i2, i1 = i1, i2
      even = (axis + other_axis) in ["XY", "YZ", "ZX"]
      if horizontal == even:
          return torch.atan2(data[..., i1], data[..., i2])
      if tait_bryan:
          return torch.atan2(-data[..., i2], data[..., i1])
      return torch.atan2(data[..., i2], -data[..., i1])
  
imports: from typing import Optional
  import torch
  import torch.nn.functional
  from ..common.datatypes import Device
label_desc: Use image node_id 7 for calling a global function with example usage: _angle_from_tan(axis, other_axis, data, horizontal, tait_bryan) and returns: torch, torch, torch