Skip to content

Instantly share code, notes, and snippets.

@zaidalyafeai
Created September 7, 2018 08:05
Show Gist options
  • Save zaidalyafeai/0ab2392763352ffbd2ac9184c0938f30 to your computer and use it in GitHub Desktop.
Save zaidalyafeai/0ab2392763352ffbd2ac9184c0938f30 to your computer and use it in GitHub Desktop.
function postprocess(tensor){
return tf.tidy(() => {
//normalization factor
const scale = tf.scalar(0.5);
//unnormalize and sqeeze
const squeezed = tensor.squeeze().mul(scale).add(scale)
//resize to canvas size
const resized = tf.image.resizeBilinear(squeezed, [w, h])
return resized
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment