class_docstr: Change tensor to PyTorch format for images (B x C x H x W).
  
  Parameters
  ----------
  channels_last : bool
      Use torch.channels_last.
  convert_back_int16 : bool
      Convert to float16.
code: def generate_code(self) -> Callable:
      do_conv = self.enable_int16conv
  
      def to_torch_image(inp: ch.Tensor, dst):
          # Returns a permuted view of the same tensor
          if do_conv:
              inp = inp.view(dtype=ch.float16)
              pass
          inp = inp.permute([0, 3, 1, 2])
          # If channels last, it's already contiguous so we're good
          if self.channels_last:
              assert inp.is_contiguous(memory_format=ch.channels_last)
              return inp
  
          # Otherwise, need to fill the allocated memory with the contiguous tensor
          dst[: inp.shape[0]] = inp.contiguous()
          return dst[: inp.shape[0]]
  
      return to_torch_image
  
imports: import torch
  import numpy
  from typing import Callable, Optional, Tuple
  from ..pipeline.allocation_query import AllocationQuery
  from ..pipeline.operation import Operation
  from ..pipeline.state import State
  from dataclasses import replace
label_desc: Use image node_id 2 for calling the ToTorchImage obj's underlying member method code with example usage: obj.generate_code() and returns: to_torch_image, dst, inp