class_docstr: Module extracting line segments from junctions and line heatmaps.
  
  Args:
      detect_thresh: The probability threshold for mean activation (0. ~ 1.)
      num_samples: Number of sampling locations along the line segments.
      inlier_thresh: The min inlier ratio to satisfy (0. ~ 1.) => 0. means no threshold.
      heatmap_low_thresh: The lowest threshold for the pixel to be considered as candidate in junction recovery.
      heatmap_high_thresh: The higher threshold for NMS in junction recovery.
      max_local_patch_radius: The max patch to be considered in local maximum search.
      lambda_radius: The lambda factor in linear local maximum search formulation
      use_candidate_suppression: Apply candidate suppression to break long segments into short sub-segments.
      nms_dist_tolerance: The distance tolerance for nms. Decide whether the junctions are on the line.
      use_heatmap_refinement: Use heatmap refinement method or not.
      heatmap_refine_cfg: The configs for heatmap refinement methods.
      use_junction_refinement: Use junction refinement method or not.
      junction_refine_cfg: The configs for junction refinement methods.
docstr: Convert the list of segments to line map.
docstr_tok: ["Convert","the","list","of","segments","to","line","map","."]
code: def segments_to_line_map(
      self, junctions: Tensor, segments: Tensor
  ) -> Tensor:
      """Convert the list of segments to line map."""
      # Create empty line map
      num_junctions = len(junctions)
      line_map = zeros(
          [num_junctions, num_junctions], device=junctions.device
      )
  
      # Get the indices of paired junctions
      _, idx_junc1 = where(
          torch.all(junctions[None] == segments[:, None, 0], dim=2)
      )
      _, idx_junc2 = where(
          torch.all(junctions[None] == segments[:, None, 1], dim=2)
      )
  
      # Assign the labels
      line_map[idx_junc1, idx_junc2] = 1
      line_map[idx_junc2, idx_junc1] = 1
  
      return line_map
  
imports: import math
  from typing import Any, Dict, Optional, Tuple
  import torch
  from kornia.core import Module, Tensor, concatenate, sin, stack, tensor, where, zeros
  from kornia.core.check import KORNIA_CHECK_SHAPE
  from kornia.geometry.bbox import nms
  from kornia.utils import map_location_to_cpu, torch_meshgrid
  from .backbones import SOLD2Net
label_desc: Use image node_id 7 for calling the LineSegmentDetectionModule obj's underlying member method code with example usage: obj.segments_to_line_map(junctions, segments) and returns: line_map