(
        samples: Tensor,
        scale_factor: int,
        img_file: Path,
    )
utility function to create a grid of GAN samples
        Args:
            samples: generated samples for feedback
            scale_factor: factor for upscaling the image
            img_file: name of file to write
        Returns: None (saves a file)
utility function to create a grid of GAN samples
        Args:
            samples: generated samples for feedback
            scale_factor: factor for upscaling the image
            img_file: name of file to write
        Returns: None (saves a file)
utility function to create a grid of GAN samples Args : samples : generated samples for feedback scale_factor : factor for upscaling the image img_file : name of file to write Returns : None ( saves a file )
def create_grid(
        samples: Tensor,
        scale_factor: int,
        img_file: Path,
    ) -> None:
        """
        utility function to create a grid of GAN samples
        Args:
            samples: generated samples for feedback
            scale_factor: factor for upscaling the image
            img_file: name of file to write
        Returns: None (saves a file)
        """
        # upsample the image
        if scale_factor > 1:
            samples = interpolate(samples, scale_factor=scale_factor)

        samples = adjust_dynamic_range(
            samples, drange_in=(-1.0, 1.0), drange_out=(0.0, 1.0)
        )

        # save the images:
        save_image(samples, img_file, nrow=int(np.sqrt(len(samples))), padding=0)
def create_grid ( samples : Tensor , scale_factor : int , img_file : Path , ) -> None : # upsample the image if scale_factor > 1 : samples = interpolate ( samples , scale_factor = scale_factor ) samples = adjust_dynamic_range ( samples , drange_in = ( - 1.0 , 1.0 ) , drange_out = ( 0.0 , 1.0 ) ) # save the images: save_image ( samples , img_file , nrow = int ( np . sqrt ( len ( samples ) ) ) , padding = 0 )