code: def generate(
      self, prompt, seq_len, temperature=1.0, filter_thres=0.9, **kwargs
  ):
      b, t, device = *prompt.shape, prompt.device
  
      out = prompt
  
      for _ in range(seq_len):
          logits = self.net(out[:, -self.seq_len :], **kwargs)[:, -1]
  
          filtered_logits = top_k(logits, thres=filter_thres)
          probs = F.softmax(filtered_logits / temperature, dim=-1)
  
          sample = torch.multinomial(probs, 1)
          out = torch.cat((out, sample), dim=-1)
  
      out = out[:, t:]
      return out
  
file_path: mixture-of-attention/mixture_of_attention/autoregressive_wrapper.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  from einops import rearrange
label_desc: Use image node_id 2 for calling the AutoregressiveWrapper obj's underlying member method code with example usage: obj.generate(prompt, seq_len, temperature, filter_thres) and returns: out