code: def style_mixing(generator, mean_style, n_source, n_target):
      source_code = paddle.randn([n_source, generator.style_dim])
      target_code = paddle.randn([n_target, generator.style_dim])
  
      resolution = 2 ** ((generator.n_latent + 2) // 2)
  
      images = [paddle.ones([1, 3, resolution, resolution]) * -1]
  
      source_image = generator(
          [source_code], truncation_latent=mean_style, truncation=0.7
      )[0]
      target_image = generator(
          [target_code], truncation_latent=mean_style, truncation=0.7
      )[0]
  
      images.append(source_image)
  
      for i in range(n_target):
          image = generator(
              [
                  target_code[i].unsqueeze(0).tile([n_source, 1]),
                  source_code,
              ],
              truncation_latent=mean_style,
              truncation=0.7,
          )[0]
          images.append(target_image[i].unsqueeze(0))
          images.append(image)
  
      images = paddle.concat(images, 0)
  
      return images
  
file_path: PaddleHub/modules/image/Image_gan/gan/styleganv2_mixing/basemodel.py
imports: import os
  import random
  import numpy
  import paddle
  from ppgan.models.generators import StyleGANv2Generator
  from ppgan.utils.download import get_path_from_url
  from ppgan.utils.visual import make_grid, tensor2img, save_image
label_desc: Use image node_id 3 for calling a global function with example usage: style_mixing(generator, mean_style, n_source, n_target) and returns: images