class_docstr: Constructs a device structure.
  
  MXNet can run operations on CPU and different GPUs.
  A Device class describes the device type and ID on which computation should be carried on.
  
  One can use mx.cpu and mx.gpu for short.
  
  See also
  ----------
  `How to run MXNet on multiple CPU/GPUs <http://mxnet.incubator.apache.org/api/faq/distributed_training>`
  for more details.
  
  Parameters
  ----------
  device_type : {'cpu', 'gpu'} or Device.
      String representing the device type.
  
  device_id : int (default=0)
      The device id of the device, needed for GPU.
  
  Note
  ----
  Device can also be used as a way to change the default device.
  
  Examples
  --------
  >>> # array on cpu
  >>> cpu_array = mx.np.ones((2, 3))
  >>> # switch default Device to GPU(2)
  >>> with mx.Device(mx.gpu(2)):
  ...     gpu_array = mx.np.ones((2, 3))
  >>> gpu_array.device
  gpu(2)
  
  One can also explicitly specify the device when creating an array.
  
  >>> gpu_array = mx.np.ones((2, 3), mx.gpu(1))
  >>> gpu_array.device
  gpu(1)
class_docstr_tok: ["Constructs","a","device","structure",".","MXNet","can","run","operations","on","CPU","and","different","GPUs",".","A","Device","class","describes","the","device","type","and","ID","on","which","computation","should","be","carried","on",".","One","can","use","mx.cpu","and","mx.gpu","for","short",".","See","also","--","--","--","--","--","`","How","to","run","MXNet","on","multiple","CPU\/GPUs","<","http",":","\/\/mxnet.incubator.apache.org\/api\/faq\/distributed_training",">","`","for","more","details",".","Parameters","--","--","--","--","--","device_type",":","{","'cpu","'",",","'gpu","'","}","or","Device",".","String","representing","the","device","type",".","device_id",":","int","(","default=0",")","The","device","id","of","the","device",",","needed","for","GPU",".","Note","--","--","Device","can","also","be","used","as","a","way","to","change","the","default","device",".","Examples","--","--","--","--",">",">",">","#","array","on","cpu",">",">",">","cpu_array","=","mx.np.ones","(","(","2",",","3",")",")",">",">",">","#","switch","default","Device","to","GPU","(","2",")",">",">",">","with","mx.Device","(","mx.gpu","(","2",")",")",":","...","gpu_array","=","mx.np.ones","(","(","2",",","3",")",")",">",">",">","gpu_array.device","gpu","(","2",")","One","can","also","explicitly","specify","the","device","when","creating","an","array",".",">",">",">","gpu_array","=","mx.np.ones","(","(","2",",","3",")",",","mx.gpu","(","1",")",")",">",">",">","gpu_array.device","gpu","(","1",")"]
docstr: Empties the memory cache for the current device.
  
  MXNet utilizes a memory pool to avoid excessive allocations.
  Calling empty_cache will empty the memory pool of the
  device. This will only free the memory of the unreferenced data.
  
  Examples
  -------
  >>> ctx = mx.gpu(0)
  >>> arr = mx.np.ones((200,200), ctx=ctx)
  >>> del arr
  >>> ctx.empty_cache() # forces release of memory allocated for arr
docstr_tok: ["Empties","the","memory","cache","for","the","current","device",".","MXNet","utilizes","a","memory","pool","to","avoid","excessive","allocations",".","Calling","empty_cache","will","empty","the","memory","pool","of","the","device",".","This","will","only","free","the","memory","of","the","unreferenced","data",".","Examples","--","--","--","-",">",">",">","ctx","=","mx.gpu","(","0",")",">",">",">","arr","=","mx.np.ones","(","(","200,200",")",",","ctx=ctx",")",">",">",">","del","arr",">",">",">","ctx.empty_cache","(",")","#","forces","release","of","memory","allocated","for","arr"]
code: def empty_cache(self):
      """Empties the memory cache for the current device.
  
      MXNet utilizes a memory pool to avoid excessive allocations.
      Calling empty_cache will empty the memory pool of the
      device. This will only free the memory of the unreferenced data.
  
      Examples
      -------
      >>> ctx = mx.gpu(0)
      >>> arr = mx.np.ones((200,200), ctx=ctx)
      >>> del arr
      >>> ctx.empty_cache() # forces release of memory allocated for arr
      """
      dev_type = ctypes.c_int(self.device_typeid)
      dev_id = ctypes.c_int(self.device_id)
      check_call(_LIB.MXStorageEmptyCache(dev_type, dev_id))
  
file_path: mxnet/python/mxnet/device.py
imports: import contextvars
  import ctypes
  from .base import _LIB
  from .base import check_call
label_desc: Use image node_id 9 for calling the Device obj's underlying member method code with example usage: obj.empty_cache() without return types