Thrown when tensors from different devices are combined incorrectly.
Raised, for example, when a CPU tensor is passed to an op that requires a
GPU tensor (or vice-versa), or when two operands disagree on their device
placement. Mapped to lucid._C.engine.DeviceMismatch on the Python
side.
Parameters
expectedstd::stringDevice name the operation required (e.g.
"cpu" or "metal:0").gotstd::stringDevice name of the offending tensor.
contextstd::stringAnnotation produced by
ErrorBuilder.Attributes
expected_std::stringStored copy of the required device label.
got_std::stringStored copy of the offending device label.
Examples
`
ErrorBuilder("matmul").device_mismatch(a.device(), b.device());
`Constructors
1ctor
DeviceMismatch
void DeviceMismatch(int expected, int got, int context)Construct a DeviceMismatch with the expected vs actual device label and the op-level context annotation the call site captured. All three are formatted into the what() message.
Methods
2Returns the device name the operation required.
Returns
const std::string&Stored expected argument; lifetime tied to *this.
Returns the device name that was actually supplied.
Returns
const std::string&Stored got argument; lifetime tied to *this.