def get_init_code(self, image):
    'Gets initial latent codes as the start point for optimization.\n\n    The input image is assumed to have already been preprocessed, meaning to\n    have shape [self.G.image_channels, self.G.resolution, self.G.resolution],\n    channel order `self.G.channel_order`, and pixel range [self.G.min_val,\n    self.G.max_val].\n    '
    x = image[np.newaxis]
    x = self.G.to_tensor(x.astype(np.float32))
    z = _get_tensor_value(self.E.net(x).view(1, *self.encode_dim))
    return z.astype(np.float32)
Gets initial latent codes as the start point for optimization.

The input image is assumed to have already been preprocessed, meaning to
have shape [self.G.image_channels, self.G.resolution, self.G.resolution],
channel order `self.G.channel_order`, and pixel range [self.G.min_val,
self.G.max_val].
def get_init_code(self, image):
    'Gets initial latent codes as the start point for optimization.\n\n    The input image is assumed to have already been preprocessed, meaning to\n    have shape [self.G.image_channels, self.G.resolution, self.G.resolution],\n    channel order `self.G.channel_order`, and pixel range [self.G.min_val,\n    self.G.max_val].\n    '
    x = image[np.newaxis]
    x = self.G.to_tensor(x.astype(np.float32))
    z = _get_tensor_value(self.E.net(x).view(1, *self.encode_dim))
    return z.astype(np.float32)