@@ -672,7 +672,7 @@ describe("Processors", () => {
672672 const image = await load_image ( TEST_IMAGES . gradient_1280x640 ) ;
673673 const image_1 = await image . resize ( 1600 , 1067 ) ;
674674 const image_2 = await image . resize ( 224 , 224 ) ;
675-
675+
676676 const white_image = await load_image ( TEST_IMAGES . white_image ) ;
677677 const white_image_1 = await white_image . resize ( 1600 , 1067 ) ;
678678 const white_image_2 = await white_image . resize ( 224 , 224 ) ;
@@ -692,28 +692,27 @@ describe("Processors", () => {
692692
693693 {
694694 // test batched no image splitting
695- const { pixel_values, pixel_attention_mask, rows, cols } = await processor ( [
696- [ white_image_1 ] ,
697- [ white_image_2 ] ,
698- [ white_image_1 , white_image_2 ] ,
699- ] , { do_image_splitting : false , return_row_col_info : true } ) ;
695+ const { pixel_values, pixel_attention_mask, rows, cols } = await processor ( [ [ white_image_1 ] , [ white_image_2 ] , [ white_image_1 , white_image_2 ] ] , { do_image_splitting : false , return_row_col_info : true } ) ;
700696 compare ( pixel_values . dims , [ 3 , 2 , 3 , 364 , 364 ] ) ;
701697 compare (
702698 pixel_values . mean ( ) . item ( ) ,
703- 2 / 3 ,
699+ 2 / 3 ,
704700 0.01 , // threshold
705701 ) ;
706702 compare ( pixel_attention_mask . dims , [ 3 , 2 , 364 , 364 ] ) ;
707703 compare (
708704 pixel_attention_mask . mean ( ) . item ( ) ,
709- 2 / 3 ,
705+ 2 / 3 ,
710706 0.001 , // threshold
711707 ) ;
712708 compare ( rows , [ [ 0 ] , [ 0 ] , [ 0 , 0 ] ] ) ;
713709 compare ( cols , [ [ 0 ] , [ 0 ] , [ 0 , 0 ] ] ) ;
714710
715711 // Test that the order of the pixel attention mask matches the python implementation
716- compare ( pixel_attention_mask . data . reduce ( ( a , b , i ) => a + i * b , 0 ) , 228217205216 ) ;
712+ compare (
713+ pixel_attention_mask . data . reduce ( ( a , b , i ) => a + i * b , 0 ) ,
714+ 228217205216 ,
715+ ) ;
717716 }
718717
719718 {
@@ -749,10 +748,7 @@ describe("Processors", () => {
749748
750749 {
751750 // batched, multiple images
752- const { pixel_values, rows, cols } = await processor ( [
753- [ image_1 ] ,
754- [ image_1 , image_2 ] ,
755- ] , { return_row_col_info : true } ) ;
751+ const { pixel_values, rows, cols } = await processor ( [ [ image_1 ] , [ image_1 , image_2 ] ] , { return_row_col_info : true } ) ;
756752 compare ( pixel_values . dims , [ 2 , 30 , 3 , 364 , 364 ] ) ;
757753 compare ( rows , [ [ 3 ] , [ 3 , 4 ] ] ) ;
758754 compare ( cols , [ [ 4 ] , [ 4 , 4 ] ] ) ;
0 commit comments