code: def custom_to_np(x):
      # saves the batch in adm style as in https://github.com/openai/guided-diffusion/blob/main/scripts/image_sample.py
      sample = x.detach().cpu()
      sample = ((sample + 1) * 127.5).clamp(0, 255).to(torch.uint8)
      sample = sample.permute(0, 2, 3, 1)
      sample = sample.contiguous()
      return sample
  
imports: import argparse
  import datetime
  import glob
  import os
  import sys
  import time
  import numpy
  import torch
  import yaml
  from ldm.models.diffusion.ddim import DDIMSampler
  from ldm.util import instantiate_from_config
  from omegaconf import OmegaConf
  from PIL import Image
  from tqdm import trange
label_desc: Use image node_id 2 for calling a global function with example usage: custom_to_np(x) and returns: sample