* Decode a (batch of) z vector into an image tensor. Z is the vector in latent * space that we want to generate an image for. * * Returns an image tensor of the shape [batch, IMAGE_HEIGHT, IMAGE_WIDTH, * IMAGE_CHANNELS] * * @param {Tensor2D} inputTensor of shape [batch, LATENT_DIMS]
(inputTensor)
| 80 | * @param {Tensor2D} inputTensor of shape [batch, LATENT_DIMS] |
| 81 | */ |
| 82 | function decodeZ(inputTensor) { |
| 83 | return tf.tidy(() => { |
| 84 | const res = decoder.predict(inputTensor).mul(255).cast('int32'); |
| 85 | const reshaped = res.reshape( |
| 86 | [inputTensor.shape[0], IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_CHANNELS]); |
| 87 | return reshaped; |
| 88 | }); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Render the latent space by z vectors through the VAE and rendering |
no test coverage detected