tfjs: Memory Leak with GPU & tf.node.decodeImage
Windows 10 20H2, Cuda 10.0, Cudnn v7.6.5, TFJS v2.7.0
Issue Running the following code fills my 1080s memory causing issues when performing any actual useful code
const { node: { decodeImage }, tidy, engine } = require('@tensorflow/tfjs-node-gpu')
const fs = require('fs')
async function main () {
engine().startScope()
const buffer = fs.readFileSync('./test.jpg')
const tensor = tidy(() => decodeImage(Buffer.from(buffer)).toFloat().expandDims())
tensor.dispose()
engine().endScope()
setTimeout(() => {
}, 5000)
}
main()
I tried without scopes & tidy. Same result. GPU usage goes back to normal after the timeout ends & the script exists.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 15 (4 by maintainers)
same issue on tf-js-node cpu
I’m having the same problem with the
tfjs-nodeCPU backend, but only for certain JPEGs shot on iPhones. Some cause a memory leak, some don’t.If it helps, here’s the header of a leaky image:
And the header of a non-leaky image:
Seems like it could have something to do with Exif data?