original_docstring: 
      Creates a grid of images with gt joints and a grid with predicted joints.
      This is a basic function for debugging purposes only.
  
      If summary_writer is not None, the grid will be written in that SummaryWriter with name "{prefix}_images" and
      "{prefix}_predictions".
  
      Args:
          images (torch.Tensor): a tensor of images with shape (batch x channels x height x width).
          target (torch.Tensor): a tensor of gt heatmaps with shape (batch x channels x height x width).
          joint_target (torch.Tensor): a tensor of gt joints with shape (batch x joints x 2).
          output (torch.Tensor): a tensor of predicted heatmaps with shape (batch x channels x height x width).
          joint_output (torch.Tensor): a tensor of predicted joints with shape (batch x joints x 2).
          joint_visibility (torch.Tensor): a tensor of joint visibility with shape (batch x joints).
          summary_writer (tb.SummaryWriter): a SummaryWriter where write the grids.
              Default: None
          step (int): summary_writer step.
              Default: 0
          prefix (str): summary_writer name prefix.
              Default: ""
  
      Returns:
          A pair of images which are built from torchvision.utils.make_grid
      
docstring: Creates a grid of images with gt joints and a grid with predicted joints.
  This is a basic function for debugging purposes only.
  
  If summary_writer is not None, the grid will be written in that SummaryWriter with name "{prefix}_images" and
  "{prefix}_predictions".
docstring_tokens: Creates a grid of images with gt joints and a grid with predicted joints . This is a basic function for debugging purposes only . If summary_writer is not None the grid will be written in that SummaryWriter with name " { prefix } _images " and " { prefix } _predictions " .
code: def save_images(images, target, joint_target, output, joint_output, joint_visibility, summary_writer=None, step=0,
                  prefix=''):
      """
      Creates a grid of images with gt joints and a grid with predicted joints.
      This is a basic function for debugging purposes only.
  
      If summary_writer is not None, the grid will be written in that SummaryWriter with name "{prefix}_images" and
      "{prefix}_predictions".
  
      Args:
          images (torch.Tensor): a tensor of images with shape (batch x channels x height x width).
          target (torch.Tensor): a tensor of gt heatmaps with shape (batch x channels x height x width).
          joint_target (torch.Tensor): a tensor of gt joints with shape (batch x joints x 2).
          output (torch.Tensor): a tensor of predicted heatmaps with shape (batch x channels x height x width).
          joint_output (torch.Tensor): a tensor of predicted joints with shape (batch x joints x 2).
          joint_visibility (torch.Tensor): a tensor of joint visibility with shape (batch x joints).
          summary_writer (tb.SummaryWriter): a SummaryWriter where write the grids.
              Default: None
          step (int): summary_writer step.
              Default: 0
          prefix (str): summary_writer name prefix.
              Default: ""
  
      Returns:
          A pair of images which are built from torchvision.utils.make_grid
      """
      # Input images with gt
      images_ok = images.detach().clone()
      images_ok[:, 0].mul_(0.229).add_(0.485)
      images_ok[:, 1].mul_(0.224).add_(0.456)
      images_ok[:, 2].mul_(0.225).add_(0.406)
      for i in range(images.shape[0]):
          joints = joint_target[i] * 4.
          joints_vis = joint_visibility[i]
  
          for joint, joint_vis in zip(joints, joints_vis):
              if joint_vis[0]:
                  a = int(joint[1].item())
                  b = int(joint[0].item())
                  # images_ok[i][:, a-1:a+1, b-1:b+1] = torch.tensor([1, 0, 0])
                  images_ok[i][0, a - 1:a + 1, b - 1:b + 1] = 1
                  images_ok[i][1:, a - 1:a + 1, b - 1:b + 1] = 0
      grid_gt = torchvision.utils.make_grid(images_ok, nrow=int(images_ok.shape[0] ** 0.5), padding=2, normalize=False)
      if summary_writer is not None:
          summary_writer.add_image(prefix + 'images', grid_gt, global_step=step)
  
      # Input images with prediction
      images_ok = images.detach().clone()
      images_ok[:, 0].mul_(0.229).add_(0.485)
      images_ok[:, 1].mul_(0.224).add_(0.456)
      images_ok[:, 2].mul_(0.225).add_(0.406)
      for i in range(images.shape[0]):
          joints = joint_output[i] * 4.
          joints_vis = joint_visibility[i]
  
          for joint, joint_vis in zip(joints, joints_vis):
              if joint_vis[0]:
                  a = int(joint[1].item())
                  b = int(joint[0].item())
                  # images_ok[i][:, a-1:a+1, b-1:b+1] = torch.tensor([1, 0, 0])
                  images_ok[i][0, a - 1:a + 1, b - 1:b + 1] = 1
                  images_ok[i][1:, a - 1:a + 1, b - 1:b + 1] = 0
      grid_pred = torchvision.utils.make_grid(images_ok, nrow=int(images_ok.shape[0] ** 0.5), padding=2, normalize=False)
      if summary_writer is not None:
          summary_writer.add_image(prefix + 'predictions', grid_pred, global_step=step)
  
      # Heatmaps
      # ToDo
      # for h in range(0,17):
      #     heatmap = torchvision.utils.make_grid(output[h].detach(), nrow=int(np.sqrt(output.shape[0])),
      #                                            padding=2, normalize=True, range=(0, 1))
      #     summary_writer.add_image('train_heatmap_%d' % h, heatmap, global_step=step + epoch*len_dl_train)
  
      return grid_gt, grid_pred
code_tokens: def save_images ( images , target , joint_target , output , joint_output , joint_visibility , summary_writer = None , step = 0 , prefix = '' ) : images_ok = images . detach ( ) . clone ( ) images_ok [ : , 0 ] . mul_ ( 0.229 ) . add_ ( 0.485 ) images_ok [ : , 1 ] . mul_ ( 0.224 ) . add_ ( 0.456 ) images_ok [ : , 2 ] . mul_ ( 0.225 ) . add_ ( 0.406 ) for i in range ( images . shape [ 0 ] ) : joints = joint_target [ i ] * 4. joints_vis = joint_visibility [ i ] for joint , joint_vis in zip ( joints , joints_vis ) : if joint_vis [ 0 ] : a = int ( joint [ 1 ] . item ( ) ) b = int ( joint [ 0 ] . item ( ) ) images_ok [ i ] [ 0 , a - 1 : a + 1 , b - 1 : b + 1 ] = 1 images_ok [ i ] [ 1 : , a - 1 : a + 1 , b - 1 : b + 1 ] = 0 grid_gt = torchvision . utils . make_grid ( images_ok , nrow = int ( images_ok . shape [ 0 ] ** 0.5 ) , padding = 2 , normalize = False ) if summary_writer is not None : summary_writer . add_image ( prefix + 'images' , grid_gt , global_step = step ) images_ok = images . detach ( ) . clone ( ) images_ok [ : , 0 ] . mul_ ( 0.229 ) . add_ ( 0.485 ) images_ok [ : , 1 ] . mul_ ( 0.224 ) . add_ ( 0.456 ) images_ok [ : , 2 ] . mul_ ( 0.225 ) . add_ ( 0.406 ) for i in range ( images . shape [ 0 ] ) : joints = joint_output [ i ] * 4. joints_vis = joint_visibility [ i ] for joint , joint_vis in zip ( joints , joints_vis ) : if joint_vis [ 0 ] : a = int ( joint [ 1 ] . item ( ) ) b = int ( joint [ 0 ] . item ( ) ) images_ok [ i ] [ 0 , a - 1 : a + 1 , b - 1 : b + 1 ] = 1 images_ok [ i ] [ 1 : , a - 1 : a + 1 , b - 1 : b + 1 ] = 0 grid_pred = torchvision . utils . make_grid ( images_ok , nrow = int ( images_ok . shape [ 0 ] ** 0.5 ) , padding = 2 , normalize = False ) if summary_writer is not None : summary_writer . add_image ( prefix + 'predictions' , grid_pred , global_step = step ) return grid_gt , grid_pred
short_docstring: Creates a grid of images with gt joints and a grid with predicted joints.
short_docstring_tokens: Creates a grid of images with gt joints and a grid with predicted joints .
comment: """
      Creates a grid of images with gt joints and a grid with predicted joints.
      This is a basic function for debugging purposes only.
  
      If summary_writer is not None, the grid will be written in that SummaryWriter with name "{prefix}_images" and
      "{prefix}_predictions".
  
      Args:
          images (torch.Tensor): a tensor of images with shape (batch x channels x height x width).
          target (torch.Tensor): a tensor of gt heatmaps with shape (batch x channels x height x width).
          joint_target (torch.Tensor): a tensor of gt joints with shape (batch x joints x 2).
          output (torch.Tensor): a tensor of predicted heatmaps with shape (batch x channels x height x width).
          joint_output (torch.Tensor): a tensor of predicted joints with shape (batch x joints x 2).
          joint_visibility (torch.Tensor): a tensor of joint visibility with shape (batch x joints).
          summary_writer (tb.SummaryWriter): a SummaryWriter where write the grids.
              Default: None
          step (int): summary_writer step.
              Default: 0
          prefix (str): summary_writer name prefix.
              Default: ""
  
      Returns:
          A pair of images which are built from torchvision.utils.make_grid
      """$SEP$# Input images with gt$SEP$# images_ok[i][:, a-1:a+1, b-1:b+1] = torch.tensor([1, 0, 0])$SEP$# Input images with prediction$SEP$# images_ok[i][:, a-1:a+1, b-1:b+1] = torch.tensor([1, 0, 0])$SEP$# Heatmaps$SEP$# ToDo$SEP$# for h in range(0,17):$SEP$#     heatmap = torchvision.utils.make_grid(output[h].detach(), nrow=int(np.sqrt(output.shape[0])),$SEP$#                                            padding=2, normalize=True, range=(0, 1))$SEP$#     summary_writer.add_image('train_heatmap_%d' % h, heatmap, global_step=step + epoch*len_dl_train)