device

class dragon.vm.torch.device(
  type='cpu',
  index=0
)[source]

Represent the device spec.

__init__

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

Create a device.

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

Properties

index

device.index

Return the device index.

Returns:
int – The device index.

type

device.type

Return the device type.

Returns:
str – The device type.

Methods

copy

device.copy()[source]

Return a cloned device.

Returns:
dragon.vm.torch.device – The new device.