class_docstr: Multi-Head Attention
docstr: Return a dict of queries / keys / values.
docstr_tok: ["Return","a","dict","of","queries","\/","keys","\/","values","."]
code: def get(self, x, fields="qkv"):
      "Return a dict of queries / keys / values."
      batch_size = x.shape[0]
      ret = {}
      if "q" in fields:
          ret["q"] = self.linears[0](x).view(
              batch_size, self.h, self.d_k
          )
      if "k" in fields:
          ret["k"] = self.linears[1](x).view(
              batch_size, self.h, self.d_k
          )
      if "v" in fields:
          ret["v"] = self.linears[2](x).view(
              batch_size, self.h, self.d_k
          )
      return ret
  
file_path: dgl/examples/pytorch/transformer/modules/attention.py
imports: import numpy
  import torch
  import torch.nn
  from .layers import clones
label_desc: Use image node_id 2 for calling the MultiHeadAttention obj's underlying member method code with example usage: obj.get(x, fields) and returns: ret