code: def test_per_symbol_to_per_seq_probs(self):
      batch_size = 1
      seq_len = 3
      candidate_size = seq_len + 2
  
      tgt_out_idx = torch.tensor([[0, 2, 1]]) + 2
      per_symbol_log_probs = torch.randn(
          batch_size, seq_len, candidate_size
      )
      per_symbol_log_probs[0, :, :2] = float("-inf")
      per_symbol_log_probs[0, 1, 2] = float("-inf")
      per_symbol_log_probs[0, 2, 2] = float("-inf")
      per_symbol_log_probs[0, 2, 4] = float("-inf")
      per_symbol_log_probs = F.log_softmax(per_symbol_log_probs, dim=2)
      per_symbol_probs = torch.exp(per_symbol_log_probs)
  
      expect_per_seq_probs = (
          per_symbol_probs[0, 0, 2]
          * per_symbol_probs[0, 1, 4]
          * per_symbol_probs[0, 2, 3]
      )
      computed_per_seq_probs = per_symbol_to_per_seq_probs(
          per_symbol_probs, tgt_out_idx
      )
      np.testing.assert_allclose(
          expect_per_seq_probs,
          computed_per_seq_probs,
          atol=0.001,
          rtol=0.0,
      )
  
imports: import itertools
  import logging
  import random
  import unittest
  from collections import defaultdict
  from itertools import permutations
  import numpy
  import pytest
  import reagent.core.types
  import torch
  import torch.nn.functional
  from parameterized import parameterized
  from reagent.model_utils.seq2slate_utils import DECODER_START_SYMBOL, mask_logits_by_idx, per_symbol_to_per_seq_log_probs, per_symbol_to_per_seq_probs, pytorch_decoder_mask, Seq2SlateMode, Seq2SlateOutputArch, subsequent_mask
  from reagent.test.ranking.seq2slate_utils import create_batch, create_seq2slate_net, MODEL_TRANSFORMER, ON_POLICY, rank_on_policy, run_seq2slate_tsp
label_desc: Use image node_id 4 for calling the TestSeq2SlateOnPolicy obj's underlying member method code with example usage: obj.test_per_symbol_to_per_seq_probs() without return types