MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / decodeZ

Function decodeZ

fashion-mnist-vae/client.js:82–89  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

80 * @param {Tensor2D} inputTensor of shape [batch, LATENT_DIMS]
81 */
82function 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

Callers 1

renderLatentSpaceFunction · 0.85

Calls 1

predictMethod · 0.45

Tested by

no test coverage detected