code: def gen_permutations(seq_len: int, num_action: int) -> torch.Tensor:
      """
      generate all seq_len permutations for a given action set
      the return shape is (SEQ_LEN, PERM_NUM, ACTION_DIM)
      """
      all_permut = torch.cartesian_prod(
          *[torch.arange(num_action)] * seq_len
      )
      if seq_len == 1:
          all_permut = all_permut.unsqueeze(1)
      all_permut = F.one_hot(all_permut, num_action).transpose(0, 1)
      return all_permut.float()
  
imports: import numpy
  import torch
  import torch.nn.functional
label_desc: Use image node_id 4 for calling a global function with example usage: gen_permutations(seq_len, num_action) and returns: all_permut