Enhance error messages in Broadcastable trait to clarify row and column count mismatches

This commit is contained in:
Palash Tyagi 2025-05-03 00:32:46 +01:00
parent bdd0a23096
commit ecb1939ec2

View File

@ -357,9 +357,9 @@ impl<T: Clone> Broadcastable<T> for T {
impl<T: Clone> Broadcastable<T> for Matrix<T> {
fn to_vec(&self, rows: usize, cols: usize) -> Vec<T> {
assert_eq!(self.rows, rows, "row count mismatch");
assert_eq!(self.cols, cols, "col count mismatch");
self.data.clone()
assert_eq!(self.rows, rows, "row count mismatch in broadcast");
assert_eq!(self.cols, cols, "col count mismatch in broadcast");
self.data.clone() // Clone the data for the broadcasted vec
}
}