Thrown when two tensors have shapes that are incompatible with an operation's broadcasting or contraction rules.
The expected and actual shapes are retained as integer vectors so callers
can inspect them programmatically rather than parsing what(). The
message string formatted by the constructor includes both shapes plus the
context annotation supplied by ErrorBuilder. Mapped to
lucid._C.engine.ShapeMismatch on the Python side.
See Also
Validator : Wraps the common precondition checks that raise this
exception via ErrorBuilder.
Parameters
expectedstd::vector<std::int64_t>gotstd::vector<std::int64_t>contextstd::stringErrorBuilder (typically the op name plus the optional detail argument and any thread-local trace).Attributes
expected_std::vector<std::int64_t>got_std::vector<std::int64_t>Examples
`
ErrorBuilder("matmul").shape_mismatch(expected, got, "rhs");
`Constructors
1ShapeMismatch
void ShapeMismatch(int expected, int got, int context)Construct a ShapeMismatch with the expected vs actual shape and the op-level context annotation the call site captured. All three become part of the formatted what() message.
Methods
2Returns the shape the operation required.
Returns
const std::vector<std::int64_t>&Stored expected argument; lifetime tied to *this.
Returns the shape that was actually supplied.
Returns
const std::vector<std::int64_t>&Stored got argument; lifetime tied to *this.