November 2019
Intermediate to advanced
296 pages
7h 52m
English
Memory management is another pitfall when we use the WebGL backend. The data that's allocated in the GPU memory buffer is outside of the memory management capabilities of the JavaScript runtime. Garbage collection does not free the memory that exists in the GPU buffer automatically, even if there is no reference to the data. The textures that are stored in the GPU buffer are managed by WebGLTexture, which is the final store of the tensor data. This class is not deallocated by the browser automatically. This means that we need to manage the memory of each tensor manually and explicitly.
To explicitly free the memory that's been allocated by the tensor, we can use the dispose method. tf.memory ...
Read now
Unlock full access