@@ -294,7 +294,7 @@ pub fn inplace_row_normalize_64(x: &mut [Vec<I64F64>]) {
294294pub fn vecdiv ( x : & [ I32F32 ] , y : & [ I32F32 ] ) -> Vec < I32F32 > {
295295 if x. len ( ) != y. len ( ) {
296296 log:: error!(
297- "vecdiv input lengths are not equal: {:?} != {:?}" ,
297+ "math error: vecdiv input lengths are not equal: {:?} != {:?}" ,
298298 x. len( ) ,
299299 y. len( )
300300 ) ;
@@ -487,7 +487,7 @@ pub fn inplace_col_max_upscale(x: &mut [Vec<I32F32>]) {
487487pub fn inplace_mask_vector ( mask : & [ bool ] , vector : & mut [ I32F32 ] ) {
488488 if mask. len ( ) != vector. len ( ) {
489489 log:: error!(
490- "inplace_mask_vector input lengths are not equal: {:?} != {:?}" ,
490+ "math error: inplace_mask_vector input lengths are not equal: {:?} != {:?}" ,
491491 mask. len( ) ,
492492 vector. len( )
493493 ) ;
@@ -508,7 +508,7 @@ pub fn inplace_mask_vector(mask: &[bool], vector: &mut [I32F32]) {
508508pub fn inplace_mask_matrix ( mask : & [ Vec < bool > ] , matrix : & mut [ Vec < I32F32 > ] ) {
509509 if mask. len ( ) != matrix. len ( ) {
510510 log:: error!(
511- "inplace_mask_matrix input sizes are not equal: {:?} != {:?}" ,
511+ "math error: inplace_mask_matrix input sizes are not equal: {:?} != {:?}" ,
512512 mask. len( ) ,
513513 matrix. len( )
514514 ) ;
@@ -538,7 +538,7 @@ pub fn inplace_mask_matrix(mask: &[Vec<bool>], matrix: &mut [Vec<I32F32>]) {
538538pub fn inplace_mask_rows ( mask : & [ bool ] , matrix : & mut [ Vec < I32F32 > ] ) {
539539 if mask. len ( ) != matrix. len ( ) {
540540 log:: error!(
541- "inplace_mask_rows input sizes are not equal: {:?} != {:?}" ,
541+ "math error: inplace_mask_rows input sizes are not equal: {:?} != {:?}" ,
542542 mask. len( ) ,
543543 matrix. len( )
544544 ) ;
@@ -560,7 +560,7 @@ pub fn inplace_mask_rows(mask: &[bool], matrix: &mut [Vec<I32F32>]) {
560560pub fn inplace_mask_cols ( mask : & [ bool ] , matrix : & mut [ Vec < I32F32 > ] ) {
561561 if mask. len ( ) != matrix. len ( ) {
562562 log:: error!(
563- "inplace_mask_cols input sizes are not equal: {:?} != {:?}" ,
563+ "math error: inplace_mask_cols input sizes are not equal: {:?} != {:?}" ,
564564 mask. len( ) ,
565565 matrix. len( )
566566 ) ;
@@ -591,7 +591,7 @@ pub fn inplace_mask_diag(matrix: &mut [Vec<I32F32>]) {
591591 // with no action. Log error if this happens.
592592 if matrix. len ( ) != first_row. len ( ) {
593593 log:: error!(
594- "inplace_mask_diag: matrix.len {:?} != first_row.len {:?}" ,
594+ "math error: inplace_mask_diag: matrix.len {:?} != first_row.len {:?}" ,
595595 matrix. len( ) ,
596596 first_row. len( )
597597 ) ;
@@ -641,7 +641,7 @@ pub fn inplace_mask_diag_except_index(matrix: &mut [Vec<I32F32>], except_index:
641641 }
642642 if matrix. len ( ) != first_row. len ( ) {
643643 log:: error!(
644- "inplace_mask_diag input matrix is now square: {:?} != {:?}" ,
644+ "math error: inplace_mask_diag input matrix is now square: {:?} != {:?}" ,
645645 matrix. len( ) ,
646646 first_row. len( )
647647 ) ;
@@ -794,7 +794,7 @@ pub fn matmul(matrix: &[Vec<I32F32>], vector: &[I32F32]) -> Vec<I32F32> {
794794 }
795795 if matrix. len ( ) != vector. len ( ) {
796796 log:: error!(
797- "matmul input sizes are not equal: {:?} != {:?}" ,
797+ "math error: matmul input sizes are not equal: {:?} != {:?}" ,
798798 matrix. len( ) ,
799799 vector. len( )
800800 ) ;
@@ -830,11 +830,11 @@ pub fn matmul_transpose(matrix: &[Vec<I32F32>], vector: &[I32F32]) -> Vec<I32F32
830830 if first_row. is_empty ( ) {
831831 return vec ! [ ] ;
832832 }
833- if matrix . len ( ) != first_row. len ( ) {
833+ if vector . len ( ) != first_row. len ( ) {
834834 log:: error!(
835- "matmul_transpose matrix is not square : {:?} != {:?}" ,
836- matrix . len( ) ,
837- first_row . len( )
835+ "math error: matmul_transpose matrix width doesn't match to vector height : {:?} != {:?}" ,
836+ first_row . len( ) ,
837+ vector . len( )
838838 ) ;
839839 }
840840
@@ -983,7 +983,7 @@ pub fn weighted_median(
983983 let zero = I32F32 :: saturating_from_num ( 0.0 ) ;
984984 if stake. len ( ) != score. len ( ) {
985985 log:: error!(
986- "weighted_median stake and score have different lengths: {:?} != {:?}" ,
986+ "math error: weighted_median stake and score have different lengths: {:?} != {:?}" ,
987987 stake. len( ) ,
988988 score. len( )
989989 ) ;
@@ -1082,7 +1082,7 @@ pub fn weighted_median_col(
10821082 use_stake. push ( zero) ;
10831083 use_score. push ( zero) ;
10841084 log:: error!(
1085- "weighted_median_col row.len() != columns: {:?} != {:?}" ,
1085+ "math error: weighted_median_col row.len() != columns: {:?} != {:?}" ,
10861086 row. len( ) ,
10871087 columns
10881088 ) ;
@@ -1189,7 +1189,7 @@ pub fn interpolate(mat1: &[Vec<I32F32>], mat2: &[Vec<I32F32>], ratio: I32F32) ->
11891189 }
11901190 if mat1. len ( ) != mat2. len ( ) {
11911191 log:: error!(
1192- "interpolate mat1.len() != mat2.len(): {:?} != {:?}" ,
1192+ "math error: interpolate mat1.len() != mat2.len(): {:?} != {:?}" ,
11931193 mat1. len( ) ,
11941194 mat2. len( )
11951195 ) ;
@@ -1213,12 +1213,12 @@ pub fn interpolate(mat1: &[Vec<I32F32>], mat2: &[Vec<I32F32>], ratio: I32F32) ->
12131213
12141214 for row1 in mat1. iter ( ) {
12151215 let ( Some ( row2) , Some ( out_row) ) = ( m2_it. next ( ) , out_it. next ( ) ) else {
1216- log:: error!( "interpolate: No more rows in mat2" ) ;
1216+ log:: error!( "math error: interpolate: No more rows in mat2" ) ;
12171217 break ;
12181218 } ;
12191219 if row1. len ( ) != row2. len ( ) {
12201220 log:: error!(
1221- "interpolate row1.len() != row2.len(): {:?} != {:?}" ,
1221+ "math error: interpolate row1.len() != row2.len(): {:?} != {:?}" ,
12221222 row1. len( ) ,
12231223 row2. len( )
12241224 ) ;
@@ -1259,7 +1259,7 @@ pub fn interpolate_sparse(
12591259 if mat1. len ( ) != mat2. len ( ) {
12601260 // In case if sizes mismatch, return clipped weights
12611261 log:: error!(
1262- "interpolate_sparse: mat1.len() != mat2.len(): {:?} != {:?}" ,
1262+ "math error: interpolate_sparse: mat1.len() != mat2.len(): {:?} != {:?}" ,
12631263 mat1. len( ) ,
12641264 mat2. len( )
12651265 ) ;
@@ -1410,7 +1410,7 @@ pub fn mat_ema_sparse(
14101410) -> Vec < Vec < ( u16 , I32F32 ) > > {
14111411 if new. len ( ) != old. len ( ) {
14121412 log:: error!(
1413- "mat_ema_sparse: new.len() == old.len(): {:?} != {:?}" ,
1413+ "math error: mat_ema_sparse: new.len() == old.len(): {:?} != {:?}" ,
14141414 new. len( ) ,
14151415 old. len( )
14161416 ) ;
@@ -1469,7 +1469,7 @@ pub fn mat_ema_alpha_sparse(
14691469 // If shapes don't match, just return `new`
14701470 if new. len ( ) != old. len ( ) || new. len ( ) != alpha. len ( ) {
14711471 log:: error!(
1472- "mat_ema_alpha_sparse shapes don't match: {:?} vs. {:?} vs. {:?}" ,
1472+ "math error: mat_ema_alpha_sparse shapes don't match: {:?} vs. {:?} vs. {:?}" ,
14731473 old. len( ) ,
14741474 new. len( ) ,
14751475 alpha. len( )
@@ -1490,15 +1490,6 @@ pub fn mat_ema_alpha_sparse(
14901490 break ;
14911491 } ;
14921492
1493- if new_row. len ( ) != old_row. len ( ) || new_row. len ( ) != alpha_row. len ( ) {
1494- log:: error!(
1495- "mat_ema_alpha_sparse row shapes don't match: {:?} vs. {:?} vs. {:?}" ,
1496- old_row. len( ) ,
1497- new_row. len( ) ,
1498- alpha_row. len( )
1499- ) ;
1500- }
1501-
15021493 // Densified accumulator sized to alpha_row length (columns outside are ignored).
15031494 let mut decayed_values = vec ! [ zero; alpha_row. len( ) ] ;
15041495
@@ -1546,7 +1537,7 @@ pub fn mat_ema_alpha(
15461537 // If outer dimensions don't match, return bonds unchanged
15471538 if new. len ( ) != old. len ( ) || new. len ( ) != alpha. len ( ) {
15481539 log:: error!(
1549- "mat_ema_alpha shapes don't match: {:?} vs. {:?} vs. {:?}" ,
1540+ "math error: mat_ema_alpha shapes don't match: {:?} vs. {:?} vs. {:?}" ,
15501541 old. len( ) ,
15511542 new. len( ) ,
15521543 alpha. len( )
0 commit comments