class_docstr: Wraps a ContinuousTransformerWrapper and applies CheckpointedLayer to each layer and permutes from channels-mid
  to channels-last that XTransformer expects.
class_docstr_tok: ["Wraps","a","ContinuousTransformerWrapper","and","applies","CheckpointedLayer","to","each","layer","and","permutes","from","channels-mid","to","channels-last","that","XTransformer","expects","."]
code: def forward(self, x, **kwargs):
      if self.needs_permute:
          x = x.permute(0, 2, 1)
      h = self.transformer(x, **kwargs)
      if self.exit_permute:
          h = h.permute(0, 2, 1)
      return h
  
imports: import functools
  import math
  import os
  import fsspec
  import torch
  import torch.nn
  import torch.nn.functional
  import torchaudio
  from transformers import LogitsWarper
  from TTS.tts.layers.tortoise.xtransformers import ContinuousTransformerWrapper, RelativePositionBias
label_desc: Use image node_id 2 for calling the CheckpointedXTransformerEncoder obj's underlying member method code with example usage: obj.forward(x) and returns: h