class_docstr: Represents a wav2vec 2.0 model as described in
  :cite:t:`https://doi.org/10.48550/arxiv.2006.11477`.
class_docstr_tok: ["Represents","a","wav2vec","2.0","model","as","described","in",":","cite",":","t",":","`","https",":","\/\/doi.org\/10.48550\/arxiv.2006.11477","`","."]
code: def _compute_logits(
      self, seqs: Tensor, targets: Tensor, distractors: Tensor
  ) -> Tensor:
      # (N, S, M) -> (N, S, 1, M)
      seqs, targets = seqs.unsqueeze(2), targets.unsqueeze(2)
  
      # The target will be always at index 0 in the candidate list.
      # (N, S, 1, M) + (N, S, L, M) -> (N, S, L + 1, M)
      candidates = torch.cat([targets, distractors], dim=2)
  
      # Perform in fp32.
      # (N, S, L + 1, M) -> (N, S, L + 1)
      logits = torch.cosine_similarity(
          seqs.float(), candidates.float(), dim=-1
      )
  
      if self.logit_temp != 1.0:
          logits = logits / self.logit_temp
  
      distractor_is_target = (targets == distractors).all(-1)
  
      # If `True`, it means codebook utilization is low. In such case we
      # mask the corresponding logits.
      if distractor_is_target.any():
          logits[:, :, 1:][distractor_is_target] = -torch.inf
  
      return logits.type_as(seqs)
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.functional import cross_entropy
  from fairseq2.models.sequence import SequenceBatch
  from fairseq2.models.wav2vec2.frontend import Wav2Vec2Frontend
  from fairseq2.models.wav2vec2.masker import Wav2Vec2Masker, extract_masked_elements
  from fairseq2.models.wav2vec2.vector_quantizer import VectorQuantizer, VectorQuantizerOutput
  from fairseq2.nn.ops import repeat_interleave
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.nn.projection import Linear
  from fairseq2.nn.transformer import TransformerEncoder
  from fairseq2.typing import DataType, Device
label_desc: Use image node_id 6 for calling the Wav2Vec2Model obj's underlying member method code with example usage: obj._compute_logits(seqs, targets, distractors) and returns: logits