Thrown when a dtype mismatch prevents an operation from executing.
Both expected and got are stored as human-readable dtype names
(e.g. "float32", "int8") rather than as raw enumerators so the
exception can be formatted directly into what() without depending on
the Dtype header. Mapped to lucid._C.engine.DtypeMismatch
on the Python side.
Parameters
expectedstd::stringRequired dtype name (or a
"|"-separated set when multiple dtypes are accepted, as emitted by Validator::dtype_in).gotstd::stringDtype name that was actually supplied.
contextstd::stringAnnotation produced by
ErrorBuilder (op name and trace).Attributes
expected_std::stringStored copy of the required dtype name.
got_std::stringStored copy of the offending dtype name.
Examples
`
ErrorBuilder("linear").dtype_mismatch(Dtype::F32, t.dtype(), "weight");
`Constructors
1ctor
DtypeMismatch
void DtypeMismatch(int expected, int got, int context)Construct a DtypeMismatch with the expected vs actual dtype name and the op-level context annotation the call site captured. Stored verbatim in what() so callers see expected float32, got int8 style text.
Methods
2Returns the dtype name that the operation required.
Returns
const std::string&Stored expected argument; lifetime tied to *this.
Returns the dtype name that was actually supplied.
Returns
const std::string&Stored got argument; lifetime tied to *this.