title: How can I iterate over all the batches from DataLoader?
body: <p>I wanted to iterate over all the batches and save the images but with this process its saving only images of the first batch</p>
  <pre><code>    for batch_idx, (test_data, test_targets) in enumerate(test_loader):
          for i in range(0, test_loader.batch_size-1):
              img = np.array(test_data[i][0])*255
              img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
              hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
              low_black = np.array([0,0,0])
              high_black = np.array([360,255,0])
              mask = cv2.inRange(hsv, low_black, high_black)
              img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
              img[mask&gt;0]=random.choice(list(color_dict.values()))
              cv2.imwrite(f'/content/test_data/{test_targets[i].item()}_{i+1}.png', img)
  </code></pre>