clear_buffer_memory

clear_buffer_memory#

class brainpy.math.clear_buffer_memory(platform=None, array=True, transform=True, compilation=False, object_name=False)[source]#

Clear all on-device buffers.

This function will be very useful when you call models in a Python loop, because it can clear all cached arrays, and clear device memory.

Warning

This operation may cause errors when you use a deleted buffer. Therefore, regenerate data always.

Parameters:
  • platform (str) – The device to clear its memory.

  • array (bool) – Clear all buffer array. Default is True.

  • compilation (bool) – Clear compilation cache. Default is False.

  • transform (bool) – Clear transform cache. Default is True.

  • object_name (bool) – Clear name cache. Default is True.