diff --git a/structures/Tensorflow.js b/structures/Tensorflow.js index 40b70a02..37c72ea1 100644 --- a/structures/Tensorflow.js +++ b/structures/Tensorflow.js @@ -76,8 +76,8 @@ module.exports = class Tensorflow { const loadedImage = imageTensor.toFloat().div(tf.scalar(255)).expandDims(); imageTensor.dispose(); const styleTensor = tf.node.decodeImage(styleImg, 3); - styleTensor.dispose(); const loadedStyle = styleTensor.toFloat().div(tf.scalar(255)).expandDims(); + styleTensor.dispose(); const stylePrediction = await this.styleModel.predict(loadedStyle); loadedStyle.dispose(); const stylizedImage = await this.transformerModel.predict([loadedImage, stylePrediction.squeeze()]);