I have the same problem as him. Here is my topic

  
    
    
    Memory fragmentation 
  
  
    Hello, 
I am dealing with memory fragment when using dataloader. 
Following is my __getitem__ function: 
    def __getitem__(self, idx):

        # Get token
        token = self.tokens[idx]

        # Get drawing
        drawing = self.drawings[idx]
        stroke = stroke_data(drawing).astype(np.float32)
        # stroke = np.expand_dims(stroke, axis=0)
        stroke = np.transpose(stroke, (1, 0)).astype(np.float32)

        drawing = eval(drawing)
        label = self.labels[idx]

        # …
  


Please help us