  
          if self.draw_transparent:
              frame = new_image
          else:
              mask = np.repeat(new_image[:, :, -1][:, :, np.newaxis], 3, axis=-1)
              foreground = new_image[:, :, :3]
              background = (predicted["image"][:, :, :3] / 255.0) * (1.0 - mask)
  
              foreground *= mask
              frame = foreground + background
  
          np.clip(frame, 0.0, 1.0, out=frame)
          return frame
 
</s> remove             frame = foreground + background

 </s> add             background *= (1.0 - mask)
            background += foreground
            frame = background </s> remove         placeholder = predicted["image"] / 255.0
        placeholder = np.concatenate((placeholder,
                                      np.zeros((frame_size[1], frame_size[0], 1))),
                                     axis=-1).astype("float32")
 </s> add         placeholder = np.zeros((frame_size[1], frame_size[0], 4), dtype="float32")
        background = predicted["image"] / np.array(255.0, dtype="float32")
        placeholder[:, :, :3] = background
 </s> remove         return np.clip(frame, 0.0, 1.0)
 </s> add         np.clip(frame, 0.0, 1.0, out=frame)
        return frame </s> remove         new_face = np.clip(new_face, 0.0, 1.0)
 </s> add         np.clip(new_face, 0.0, 1.0, out=new_face) </s> remove         patched_face = np.rint(patched_face * 255.0).astype("uint8")
 </s> add         patched_face *= 255.0
        patched_face = np.rint(
            patched_face,
            out=np.empty(patched_face.shape, dtype="uint8"),
            casting='unsafe'
        )
            foreground, mask = np.split(new_image, (3, ), axis=-1)
  
          if self.draw_transparent:
              frame = new_image
          else:
            foreground, mask = np.split(new_image, (3, ), axis=-1)
            foreground, mask = np.split(new_image, (3, ), axis=-1)
            foreground, mask = np.split(new_image, (3, ), axis=-1)
            foreground, mask = np.split(new_image, (3, ), axis=-1)
              foreground *= mask
              frame = foreground + background
  
          np.clip(frame, 0.0, 1.0, out=frame)
          return frame
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Optimized numpy functions in Converter (#838) 
lib/convert.py