Skip to main content

Python class

DevicePlacementPolicy

DevicePlacementPolicy​

class max.graph.DevicePlacementPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

source

Bases: Enum

Controls behavior when an op implicitly transfers a tensor to CPU.

Ops that only have CPU kernels must transfer non-CPU tensors before executing. This policy controls how that situation is reported:

  • Ignore: transfer silently, no message.
  • Warn (default): emit a UserWarning naming the op and the tracking ticket for GPU support.
  • Error: raise ValueError, making the implicit transfer a hard build-time failure.

Pass via Graph(..., strict_device_placement=DevicePlacementPolicy.Error).

Error​

Error = 'error'

source

Ignore​

Ignore = 'ignore'

source

Warn​

Warn = 'warn'

source