use onnx_runtime_ir::ValueId;
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
#[non_exhaustive]
pub enum ShapeInferError {
#[error("graph has a cycle; cannot order nodes for shape inference")]
CycleDetected,
#[error("op `{op}`: expected {expected} inputs, found {found}")]
Arity {
op: String,
expected: String,
found: usize,
},
#[error("op `{op}`: input #{index} has invalid rank {rank} ({detail})")]
InvalidRank {
op: String,
index: usize,
rank: usize,
detail: String,
},
#[error("op `{op}`: attribute `{attr}` is missing or has the wrong type")]
MissingAttribute { op: String, attr: String },
#[error("op `{op}`: {detail}")]
Invalid { op: String, detail: String },
#[error(
"value {value:?}: inferred dim {inferred} conflicts with declared dim {declared} at axis {axis}"
)]
ShapeConflict {
value: ValueId,
axis: usize,
inferred: i64,
declared: i64,
},
#[error("value {value:?}: inferred rank {inferred} conflicts with declared rank {declared}")]
RankConflict {
value: ValueId,
inferred: usize,
declared: usize,
},
}