class_docstr: Multi-headed attention from 'Attention Is All You Need' paper
class_docstr_tok: ["Multi-headed","attention","from","'Attention","Is","All","You","Need","'","paper"]
code: def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
      return (
          tensor.view(bsz, seq_len, self.num_heads, self.head_dim)
          .transpose(1, 2)
          .contiguous()
      )
  
imports: from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from transformers.activations import ACT2FN
  from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
  from transformers.utils import ModelOutput, logging
  from text_generation_server.utils.layers import TensorParallelColumnLinear, TensorParallelRowLinear, TensorParallelEmbedding
label_desc: Use image node_id 2 for calling the IdeficsVisionAttention obj's underlying member method code with example usage: obj._shape(tensor, seq_len, bsz) and returns: tensor