original_docstring: 
      Collate function to be used when wrapping a CLEVRDialogDataset in a
      DataLoader. Returns a tuple of the following:
  
      - imgs: FloatTensor of shape (N, C, H, W)
      - objs: LongTensor of shape (O,) giving categories for all objects
      - boxes: FloatTensor of shape (O, 4) giving boxes for all objects
      - triples: FloatTensor of shape (T, 3) giving all triples, where
      triples[t] = [i, p, j] means that [objs[i], p, objs[j]] is a triple
      - obj_to_img: LongTensor of shape (O,) mapping objects to images;
      obj_to_img[i] = n means that objs[i] belongs to imgs[n]
      - triple_to_img: LongTensor of shape (T,) mapping triples to images;
      triple_to_img[t] = n means that triples[t] belongs to imgs[n].
      
docstring: Collate function to be used when wrapping a CLEVRDialogDataset in a
  DataLoader. Returns a tuple of the following.
  
  
docstring_tokens: Collate function to be used when wrapping a CLEVRDialogDataset in a DataLoader . Returns a tuple of the following .
code: def clevr_collate_fn(batch):
      """
      Collate function to be used when wrapping a CLEVRDialogDataset in a
      DataLoader. Returns a tuple of the following:
  
      - imgs: FloatTensor of shape (N, C, H, W)
      - objs: LongTensor of shape (O,) giving categories for all objects
      - boxes: FloatTensor of shape (O, 4) giving boxes for all objects
      - triples: FloatTensor of shape (T, 3) giving all triples, where
      triples[t] = [i, p, j] means that [objs[i], p, objs[j]] is a triple
      - obj_to_img: LongTensor of shape (O,) mapping objects to images;
      obj_to_img[i] = n means that objs[i] belongs to imgs[n]
      - triple_to_img: LongTensor of shape (T,) mapping triples to images;
      triple_to_img[t] = n means that triples[t] belongs to imgs[n].
      """
      # batch is a list, and each element is (image, objs, boxes, triplets)
      all_imgs, all_boxes, all_triplets = [], [], []
      all_objs = collections.defaultdict(list)
      all_obj_to_img, all_triple_to_img = [], []
      obj_offset = 0
  
      for i, (img, objs, boxes, triplets) in enumerate(batch):
          all_imgs.append(img[None])
          # to determine number objects, use an arbitrary choice - first attribute
          O, T = objs[list(objs.keys())[0]].size(0), triplets.size(0)
  
          for k, v in objs.items():
              all_objs[k].append(v)
  
          all_boxes.append(boxes)
          triplets = triplets.clone()
          triplets[:, 0] += obj_offset
          triplets[:, 2] += obj_offset
          all_triplets.append(triplets)
  
          all_obj_to_img.append(torch.LongTensor(O).fill_(i))
          all_triple_to_img.append(torch.LongTensor(T).fill_(i))
          obj_offset += O
  
      all_imgs = torch.cat(all_imgs)
  
      for k, v in all_objs.items():
          all_objs[k] = torch.cat(v)
  
      all_boxes = torch.cat(all_boxes)
      all_triplets = torch.cat(all_triplets)
      all_obj_to_img = torch.cat(all_obj_to_img)
      all_triple_to_img = torch.cat(all_triple_to_img)
  
      out = (all_imgs, all_objs, all_boxes, all_triplets, all_obj_to_img, all_triple_to_img)
      return out
code_tokens: def clevr_collate_fn ( batch ) : all_imgs , all_boxes , all_triplets = [ ] , [ ] , [ ] all_objs = collections . defaultdict ( list ) all_obj_to_img , all_triple_to_img = [ ] , [ ] obj_offset = 0 for i , ( img , objs , boxes , triplets ) in enumerate ( batch ) : all_imgs . append ( img [ None ] ) O , T = objs [ list ( objs . keys ( ) ) [ 0 ] ] . size ( 0 ) , triplets . size ( 0 ) for k , v in objs . items ( ) : all_objs [ k ] . append ( v ) all_boxes . append ( boxes ) triplets = triplets . clone ( ) triplets [ : , 0 ] += obj_offset triplets [ : , 2 ] += obj_offset all_triplets . append ( triplets ) all_obj_to_img . append ( torch . LongTensor ( O ) . fill_ ( i ) ) all_triple_to_img . append ( torch . LongTensor ( T ) . fill_ ( i ) ) obj_offset += O all_imgs = torch . cat ( all_imgs ) for k , v in all_objs . items ( ) : all_objs [ k ] = torch . cat ( v ) all_boxes = torch . cat ( all_boxes ) all_triplets = torch . cat ( all_triplets ) all_obj_to_img = torch . cat ( all_obj_to_img ) all_triple_to_img = torch . cat ( all_triple_to_img ) out = ( all_imgs , all_objs , all_boxes , all_triplets , all_obj_to_img , all_triple_to_img ) return out
short_docstring: Collate function to be used when wrapping a CLEVRDialogDataset in a
  DataLoader.
short_docstring_tokens: Collate function to be used when wrapping a CLEVRDialogDataset in a DataLoader .
comment: """
      Collate function to be used when wrapping a CLEVRDialogDataset in a
      DataLoader. Returns a tuple of the following:
  
      - imgs: FloatTensor of shape (N, C, H, W)
      - objs: LongTensor of shape (O,) giving categories for all objects
      - boxes: FloatTensor of shape (O, 4) giving boxes for all objects
      - triples: FloatTensor of shape (T, 3) giving all triples, where
      triples[t] = [i, p, j] means that [objs[i], p, objs[j]] is a triple
      - obj_to_img: LongTensor of shape (O,) mapping objects to images;
      obj_to_img[i] = n means that objs[i] belongs to imgs[n]
      - triple_to_img: LongTensor of shape (T,) mapping triples to images;
      triple_to_img[t] = n means that triples[t] belongs to imgs[n].
      """$SEP$# batch is a list, and each element is (image, objs, boxes, triplets)$SEP$# to determine number objects, use an arbitrary choice - first attribute