DeviceSpec

class dragon.DeviceSpec(
  type='cpu',
  index=0
)[source]

Describe a computation device.

__init__

DeviceSpec.__init__(
  type='cpu',
  index=0
)[source]

Create a DeviceSpec.

Parameters:
  • type (str, optional, default='cpu') – The device type.
  • index (int, optional, default=0) – The device index.

Properties

index

DeviceSpec.index

Return the device index.

Returns:
int – The device index.

type

DeviceSpec.type

Return the device type.

Returns:
str – The device type.

Methods

copy

DeviceSpec.copy()[source]

Return a cloned spec.

Returns:
dragon.DeviceSpec – The new device spec.