code: def generate_images(network_pkl, seeds, truncation_psi):
      print('Loading networks from "%s"...' % network_pkl)
      _G, _D, Gs = pretrained_networks.load_networks(network_pkl)
      noise_vars = [
          var
          for name, var in Gs.components.synthesis.vars.items()
          if name.startswith("noise")
      ]
  
      Gs_kwargs = dnnlib.EasyDict()
      Gs_kwargs.output_transform = dict(
          func=tflib.convert_images_to_uint8, nchw_to_nhwc=True
      )
      Gs_kwargs.randomize_noise = False
      if truncation_psi is not None:
          Gs_kwargs.truncation_psi = truncation_psi
  
      for seed_idx, seed in enumerate(seeds):
          print(
              "Generating image for seed %d (%d/%d) ..."
              % (seed, seed_idx, len(seeds))
          )
          rnd = np.random.RandomState(seed)
          z = rnd.randn(
              1, *Gs.input_shape[1:]
          )  # [minibatch, component]
          tflib.set_vars(
              {
                  var: rnd.randn(*var.shape.as_list())
                  for var in noise_vars
              }
          )  # [height, width]
          images = Gs.run(
              z, None, **Gs_kwargs
          )  # [minibatch, height, width, channel]
          PIL.Image.fromarray(images[0], "RGB").save(
              dnnlib.make_run_dir_path("seed%04d.png" % seed)
          )
  
file_path: insightface/reconstruction/ostec/external/stylegan2/run_generator.py
imports: import argparse
  import numpy
  import PIL.Image
  import dnnlib
  import dnnlib.tflib
  import re
  import sys
  import pretrained_networks
label_desc: Use image node_id 1 for calling a global function with example usage: generate_images(network_pkl, seeds, truncation_psi) without return types