class_docstr: A utility class to help extract subsequences out of a batch
  of sequences
  
  Arguments
  ---------
  word_separator: int
      the index of the word separator (used in p_seq)
  word_separator_base int
      the index of word separators used in unprocessed
      targets (if different)
  
  Example
  -------
  >>> import torch
  >>> from speechbrain.lobes.models.g2p.homograph import SubsequenceExtractor
  >>> extractor = SubsequenceExtractor()
  >>> phns = torch.Tensor(
  ...     [[1, 2, 0, 1, 3, 0, 2, 1, 0],
  ...      [2, 1, 3, 0, 1, 2, 0, 3, 2]]
  ... )
  >>> phn_lens = torch.IntTensor([8, 9])
  >>> subsequence_phn_start = torch.IntTensor([3, 4])
  >>> subsequence_phn_end = torch.IntTensor([5, 7])
  >>> p_seq = torch.Tensor([
  ...     [[0., 1., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [1., 0., 0., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [1., 0., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [0., 1., 0., 0.],
  ...      [1., 0., 0., 0.]],
  ...     [[0., 0., 1., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [1., 0., 0., 0.],
  ...      [0., 1., 0., 0.],
  ...      [0., 0., 1., 0.],
  ...      [1., 0., 0., 0.],
  ...      [0., 0., 0., 1.],
  ...      [0., 0., 1., 0.]]
  ... ])
  >>> extractor.extract_seq(
  ...    phns,
  ...    phn_lens,
  ...    p_seq,
  ...    subsequence_phn_start,
  ...    subsequence_phn_end
  ... )
  (tensor([[[0., 1., 0., 0.],
           [0., 0., 0., 1.],
           [0., 0., 0., 0.]],
  <BLANKLINE>
          [[0., 1., 0., 0.],
           [0., 0., 1., 0.],
           [0., 0., 0., 0.]]]), tensor([[1., 3., 0.],
          [1., 2., 0.]]), tensor([0.6667, 1.0000]))
docstr: Determines the word boundaries for the specified
  word indexes within a sequence
  
  Arguments
  ---------
  seq: torch.Tensor
      a sequence (phonemes or graphemes)
  word_indexes:
      the word indexes
  edge: int
      a tensor indicating the last position
  word_separator: int
      the word separator token
  
  Returns
  -------
  start: torch.Tensor
      word start indexes
  end: torch.Tensor
      word end indexes
docstr_tok: ["Determines","the","word","boundaries","for","the","specified","word","indexes","within","a","sequence","Arguments","--","--","--","--","-","seq",":","torch.Tensor","a","sequence","(","phonemes","or","graphemes",")","word_indexes",":","the","word","indexes","edge",":","int","a","tensor","indicating","the","last","position","word_separator",":","int","the","word","separator","token","Returns","--","--","--","-","start",":","torch.Tensor","word","start","indexes","end",":","torch.Tensor","word","end","indexes"]
code: def _get_word_boundaries(
      self, seq, word_indexes, edge, word_separator=None
  ):
      """Determines the word boundaries for the specified
      word indexes within a sequence
  
      Arguments
      ---------
      seq: torch.Tensor
          a sequence (phonemes or graphemes)
      word_indexes:
          the word indexes
      edge: int
          a tensor indicating the last position
      word_separator: int
          the word separator token
  
      Returns
      -------
      start: torch.Tensor
          word start indexes
      end: torch.Tensor
          word end indexes
      """
      if word_separator is None:
          word_separator = self.word_separator
      # Find all spaces in the tensor
      tokens = seq.argmax(-1) if seq.dim() == 3 else seq
  
      # Compute an auxiliary range tensor to help determine
      # word boundaries
      words_range = torch.arange(
          tokens.size(-1), device=tokens.device
      ).expand_as(tokens)
  
      word_boundaries = (tokens == word_separator) | (
          words_range == edge
      )
  
      # Find which word a given position in the tensor belongs in
      words = word_boundaries.cumsum(dim=-1)
  
      index_match = words == word_indexes.unsqueeze(-1)
  
      start = self._get_positions(
          index_match, words_range, torch.min, edge
      )
      end = self._get_positions(index_match, words_range, torch.max, 0)
      return start, end
  
imports: import torch
  from torch import nn
label_desc: Use image node_id 8 for calling the SubsequenceExtractor obj's underlying member method code with example usage: obj._get_word_boundaries(seq, word_indexes, edge, word_separator) and returns: start,  end