Workspace

class dragon.Workspace[source]

Standalone environment for resources and computations.

__init__

Workspace.__init__()[source]

Create a Workspace.

Methods

as_default

Workspace.as_default()[source]

Set as the default workspace.

Call this method with the with keyword.

Once with is exited, the previous default will be set.

Returns:
dragon.Workspace – This workspace.

clear

Workspace.clear()[source]

Release the tensors, operators and graphs.

memory_allocated

Workspace.memory_allocated(
  device_type='cpu',
  device_index=0
)[source]

Return the size of device memory used by tensors.

Parameters:
  • device_type (str, optional) – The device type.
  • device_index (int, optional) – The device index.
Returns:

int – The length of allocated bytes.

merge_from

Workspace.merge_from(other)[source]

Merge resources from the other.

Parameters:
Returns:

dragon.Workspace – This workspace.