code: def gather(outputs: List[Batch]) -> TensorOrTensors:
      """Concatenates output micro-batches into a mini-batch."""
      output: TensorOrTensors
  
      if outputs[0].atomic:
          tensors = tuple(b.tensor for b in outputs)
          output = torch.cat(tensors)
      else:
          rotated = [b.tensors for b in outputs]
          output_buf = []
  
          for tensors in zip(*rotated):
              output_buf.append(torch.cat(tensors))
  
          output = tuple(output_buf)
  
      return output
  
imports: import typing
  from typing import Callable, Iterable, Iterator, List, Tuple, Union, cast
  import torch
  from torch import Tensor
  import torch.cuda.comm
label_desc: Use image node_id 3 for calling a global function with example usage: gather(outputs) and returns: output