class_docstr: Time synchronous beam search algorithm.
class_docstr_tok: ["Time","synchronous","beam","search","algorithm","."]
docstr: Reset object for a new utterance.
docstr_tok: ["Reset","object","for","a","new","utterance","."]
code: def reset(self, enc_output: torch.Tensor):
      """Reset object for a new utterance."""
      self.attn_cache = dict()
      self.lm_cache = dict()
      self.enc_output = enc_output
      self.sos_th = self.sos_th.to(enc_output.device)
  
      if self.decoder is not None:
          init_decoder_state = self.decoder.init_state(enc_output)
          decoder_scores, decoder_state = self.decoder.score(
              self.sos_th, init_decoder_state, enc_output
          )
          self.attn_cache[(self.sos,)] = CacheItem(
              state=decoder_state,
              scores=decoder_scores,
              log_sum=0.0,
          )
  
          # TODO(brian): change to hyp_primer to support prompts
          decoder_scores, decoder_state = self.decoder.score(
              torch.tensor(
                  [
                      self.sos,
                  ],
                  device=enc_output.device,
              ),
              init_decoder_state,
              enc_output,
          )
          self.attn_cache[(self.sos,)] = CacheItem(
              state=decoder_state,
              scores=decoder_scores,
              log_sum=0.0,
          )
      if self.lm is not None:
          init_lm_state = self.lm.init_state(enc_output)
          lm_scores, lm_state = self.lm.score(
              self.sos_th, init_lm_state, enc_output
          )
          self.lm_cache[(self.sos,)] = CacheItem(
              state=lm_state,
              scores=lm_scores,
              log_sum=0.0,
          )
  
file_path: espnet/espnet/nets/beam_search_timesync_streaming.py
imports: import logging
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Any, Dict, List, Tuple
  import numpy
  import torch
  from espnet.nets.beam_search import Hypothesis
  from espnet.nets.scorer_interface import ScorerInterface
label_desc: Use image node_id 2 for calling the BeamSearchTimeSyncStreaming obj's underlying member method code with example usage: obj.reset(enc_output) without return types