class_docstr: Multi-head attention module
class_docstr_tok: ["Multi-head","attention","module"]
code: def split_qkv_packed(self, inp, qk_inp=None):
      v_inp_repeated = inp.repeat(self.n_head, 1).view(
          self.n_head, -1, inp.size(-1)
      )  # n_head x len_inp x d_model
      if qk_inp is None:
          qk_inp_repeated = v_inp_repeated
      else:
          qk_inp_repeated = qk_inp.repeat(self.n_head, 1).view(
              self.n_head, -1, qk_inp.size(-1)
          )
  
      if not self.partitioned:
          q_s = torch.bmm(
              qk_inp_repeated, self.w_qs
          )  # n_head x len_inp x d_k
          k_s = torch.bmm(
              qk_inp_repeated, self.w_ks
          )  # n_head x len_inp x d_k
          v_s = torch.bmm(
              v_inp_repeated, self.w_vs
          )  # n_head x len_inp x d_v
      else:
          q_s = torch.cat(
              [
                  torch.bmm(
                      qk_inp_repeated[:, :, : self.d_content],
                      self.w_qs1,
                  ),
                  torch.bmm(
                      qk_inp_repeated[:, :, self.d_content :],
                      self.w_qs2,
                  ),
              ],
              -1,
          )
          k_s = torch.cat(
              [
                  torch.bmm(
                      qk_inp_repeated[:, :, : self.d_content],
                      self.w_ks1,
                  ),
                  torch.bmm(
                      qk_inp_repeated[:, :, self.d_content :],
                      self.w_ks2,
                  ),
              ],
              -1,
          )
          v_s = torch.cat(
              [
                  torch.bmm(
                      v_inp_repeated[:, :, : self.d_content], self.w_vs1
                  ),
                  torch.bmm(
                      v_inp_repeated[:, :, self.d_content :], self.w_vs2
                  ),
              ],
              -1,
          )
      return q_s, k_s, v_s
  
imports: import numpy
  import functools
  import sys
  import torch
  from torch.autograd import Variable
  import torch.nn
  import torch.nn.init
label_desc: Use image node_id 2 for calling the MultiHeadAttention obj's underlying member method code with example usage: obj.split_qkv_packed(inp, qk_inp) and returns: q_s,  k_s,  v_s