How can I save generate image in new separate folder?

Hi,

If I understand correctly, this method will save a 3D tensor as an image. But I cannot think of any method to save all images in one batch operation. Although you can save them as a grid, but not separate images.

def save_img(inp, idx, path):
    inp = inp.cpu().numpy().transpose((1, 2, 0))
    mean = np.array([0.485, 0.456, 0.406])  # if inp is normalized
    std = np.array([0.229, 0.224, 0.225])  # if inp is normalized
    inp = std * inp + mean
    inp = np.clip(inp, 0, 1)
    cv2.imwrite(path+str(idx)+'.png', inp)

Bests