@@ -341,15 +341,24 @@ def _test_marigold_depth(
341341 pipe_kwargs .get ("processing_resolution" , 768 ),
342342 "Unexpected output resolution" ,
343343 )
344-
345344 self .assertTrue (np .allclose (prediction_slice , expected_slice , atol = atol ))
346345
347346 def test_marigold_depth_einstein_f32_cpu_G0_S1_P32_E1_B1_M1 (self ):
347+ # fmt: off
348+ expected_slices = Expectations (
349+ {
350+ ("cuda" , 7 ): np .array ([0.4328 , 0.4328 , 0.4328 , 0.4328 , 0.4328 , 0.4328 , 0.4328 , 0.4328 , 0.4328 ]),
351+ ("xpu" , None ): np .array ([0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 ]),
352+ }
353+ )
354+ expected_slice = expected_slices .get_expectation ()
355+ # fmt: on
356+
348357 self ._test_marigold_depth (
349358 is_fp16 = False ,
350359 device = "cpu" ,
351360 generator_seed = 0 ,
352- expected_slice = np . array ([ 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 , 0.4323 ]) ,
361+ expected_slice = expected_slice ,
353362 num_inference_steps = 1 ,
354363 processing_resolution = 32 ,
355364 ensemble_size = 1 ,
@@ -358,11 +367,20 @@ def test_marigold_depth_einstein_f32_cpu_G0_S1_P32_E1_B1_M1(self):
358367 )
359368
360369 def test_marigold_depth_einstein_f32_accelerator_G0_S1_P768_E1_B1_M1 (self ):
370+ # fmt: off
371+ expected_slices = Expectations (
372+ {
373+ ("cuda" , 7 ): np .array ([0.1243 , 0.1265 , 0.1291 , 0.1239 , 0.1252 , 0.1266 , 0.1245 , 0.1225 , 0.1179 ]),
374+ ("xpu" , None ): np .array ([0.1244 , 0.1265 , 0.1292 , 0.1240 , 0.1252 , 0.1266 , 0.1246 , 0.1226 , 0.1180 ]),
375+ }
376+ )
377+ expected_slice = expected_slices .get_expectation ()
378+ # fmt: on
361379 self ._test_marigold_depth (
362380 is_fp16 = False ,
363381 device = torch_device ,
364382 generator_seed = 0 ,
365- expected_slice = np . array ([ 0.1244 , 0.1265 , 0.1292 , 0.1240 , 0.1252 , 0.1266 , 0.1246 , 0.1226 , 0.1180 ]) ,
383+ expected_slice = expected_slice ,
366384 num_inference_steps = 1 ,
367385 processing_resolution = 768 ,
368386 ensemble_size = 1 ,
@@ -371,11 +389,21 @@ def test_marigold_depth_einstein_f32_accelerator_G0_S1_P768_E1_B1_M1(self):
371389 )
372390
373391 def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E1_B1_M1 (self ):
392+ # fmt: off
393+ expected_slices = Expectations (
394+ {
395+ ("cuda" , 7 ): np .array ([0.1242 , 0.1263 , 0.1290 , 0.1237 , 0.1249 , 0.1263 , 0.1243 , 0.1223 , 0.1177 ]),
396+ ("xpu" , 3 ): np .array ([0.1241 , 0.1262 , 0.1290 , 0.1237 , 0.125 , 0.1265 , 0.1243 , 0.1223 , 0.1179 ]),
397+ ("xpu" , 5 ): np .array ([0.1244 , 0.1265 , 0.1292 , 0.1240 , 0.1252 , 0.1266 , 0.1245 , 0.1225 , 0.1179 ]),
398+ }
399+ )
400+ expected_slice = expected_slices .get_expectation ()
401+ # fmt: on
374402 self ._test_marigold_depth (
375403 is_fp16 = True ,
376404 device = torch_device ,
377405 generator_seed = 0 ,
378- expected_slice = np . array ([ 0.1241 , 0.1262 , 0.1290 , 0.1238 , 0.1250 , 0.1265 , 0.1244 , 0.1225 , 0.1179 ]) ,
406+ expected_slice = expected_slice ,
379407 num_inference_steps = 1 ,
380408 processing_resolution = 768 ,
381409 ensemble_size = 1 ,
@@ -384,11 +412,21 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E1_B1_M1(self):
384412 )
385413
386414 def test_marigold_depth_einstein_f16_accelerator_G2024_S1_P768_E1_B1_M1 (self ):
415+ # fmt: off
416+ expected_slices = Expectations (
417+ {
418+ ("cuda" , 7 ): np .array ([0.1709 , 0.1722 , 0.1736 , 0.1699 , 0.1699 , 0.1693 , 0.1697 , 0.1661 , 0.1589 ]),
419+ ("xpu" , 3 ): np .array ([0.1709 , 0.1722 , 0.1736 , 0.1699 , 0.1698 , 0.1693 , 0.1696 , 0.1660 , 0.1589 ]),
420+ ("xpu" , 5 ): np .array ([0.1709 , 0.1722 , 0.1738 , 0.1699 , 0.1699 , 0.1694 , 0.1697 , 0.1661 , 0.1589 ]),
421+ }
422+ )
423+ expected_slice = expected_slices .get_expectation ()
424+ # fmt: on
387425 self ._test_marigold_depth (
388426 is_fp16 = True ,
389427 device = torch_device ,
390428 generator_seed = 2024 ,
391- expected_slice = np . array ([ 0.1710 , 0.1725 , 0.1738 , 0.1700 , 0.1700 , 0.1696 , 0.1698 , 0.1663 , 0.1592 ]) ,
429+ expected_slice = expected_slice ,
392430 num_inference_steps = 1 ,
393431 processing_resolution = 768 ,
394432 ensemble_size = 1 ,
@@ -400,9 +438,9 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S2_P768_E1_B1_M1(self):
400438 # fmt: off
401439 expected_slices = Expectations (
402440 {
403- ("cuda" , 7 ): np .array ([0.1085 , 0.1098 , 0.1110 , 0.1081 , 0.1085 , 0.1082 , 0.1085 , 0.1057 , 0.0996 ]),
404- ("xpu" , 3 ): np .array ([0.1084 , 0.1096 , 0.1108 , 0.1080 , 0.1083 , 0.1080 ,
405- 0. 1085 , 0.1057 , 0.0996 ]),
441+ ("cuda" , 7 ): np .array ([0.1083 , 0.1096 , 0.1107 , 0.1078 , 0.1082 , 0.1079 , 0.1084 , 0.1055 , 0.0994 ]),
442+ ("xpu" , 3 ): np .array ([0.1083 , 0.1096 , 0.1107 , 0.1079 , 0.1082 , 0.1079 , 0. 1083 , 0.1055 , 0.0994 ]) ,
443+ ( "xpu" , 5 ): np . array ([ 0.1086 , 0.1098 , 0.1111 , 0.1082 , 0. 1085, 0.1081 , 0.1086 , 0.1057 , 0.0996 ]),
406444 }
407445 )
408446 expected_slice = expected_slices .get_expectation ()
@@ -421,11 +459,21 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S2_P768_E1_B1_M1(self):
421459 )
422460
423461 def test_marigold_depth_einstein_f16_accelerator_G0_S1_P512_E1_B1_M1 (self ):
462+ # fmt: off
463+ expected_slices = Expectations (
464+ {
465+ ("cuda" , 7 ): np .array ([0.2683 , 0.2693 , 0.2698 , 0.2666 , 0.2632 , 0.2615 , 0.2656 , 0.2603 , 0.2573 ]),
466+ ("xpu" , 3 ): np .array ([0.2678 , 0.2688 , 0.2695 , 0.2661 , 0.2629 , 0.2612 , 0.2654 , 0.2600 , 0.2573 ]),
467+ ("xpu" , 5 ): np .array ([0.2683 , 0.2693 , 0.2698 , 0.2666 , 0.2634 , 0.2617 ,0.2659 , 0.2603 , 0.2576 ]),
468+ }
469+ )
470+ expected_slice = expected_slices .get_expectation ()
471+ # fmt: on
424472 self ._test_marigold_depth (
425473 is_fp16 = True ,
426474 device = torch_device ,
427475 generator_seed = 0 ,
428- expected_slice = np . array ([ 0.2683 , 0.2693 , 0.2698 , 0.2666 , 0.2632 , 0.2615 , 0.2656 , 0.2603 , 0.2573 ]) ,
476+ expected_slice = expected_slice ,
429477 num_inference_steps = 1 ,
430478 processing_resolution = 512 ,
431479 ensemble_size = 1 ,
@@ -434,11 +482,22 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S1_P512_E1_B1_M1(self):
434482 )
435483
436484 def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E3_B1_M1 (self ):
485+ # fmt: off
486+ expected_slices = Expectations (
487+ {
488+ ("cuda" , 7 ): np .array ([0.1075 , 0.1099 , 0.1121 , 0.1069 , 0.1070 , 0.1066 , 0.1063 , 0.1011 , 0.0931 ]),
489+ ("xpu" , 3 ): np .array ([0.1074 , 0.1097 , 0.1120 , 0.1068 , 0.1069 , 0.1064 , 0.1061 , 0.1010 , 0.0930 ]),
490+ ("xpu" , 5 ): np .array ([0.1196 , 0.1212 , 0.1234 , 0.1189 , 0.1193 , 0.1199 , 0.1192 , 0.1162 , 0.1105 ]),
491+ }
492+ )
493+ expected_slice = expected_slices .get_expectation ()
494+ # fmt: on
495+
437496 self ._test_marigold_depth (
438497 is_fp16 = True ,
439498 device = torch_device ,
440499 generator_seed = 0 ,
441- expected_slice = np . array ([ 0.1200 , 0.1215 , 0.1237 , 0.1193 , 0.1197 , 0.1202 , 0.1196 , 0.1166 , 0.1109 ]) ,
500+ expected_slice = expected_slice ,
442501 num_inference_steps = 1 ,
443502 processing_resolution = 768 ,
444503 ensemble_size = 3 ,
@@ -448,11 +507,22 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E3_B1_M1(self):
448507 )
449508
450509 def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E4_B2_M1 (self ):
510+ # fmt: off
511+ expected_slices = Expectations (
512+ {
513+ ("cuda" , 7 ): np .array ([0.0933 , 0.0952 , 0.0969 , 0.0927 , 0.0927 , 0.0918 , 0.0922 , 0.0872 , 0.0792 ]),
514+ ("xpu" , 3 ): np .array ([0.1010 , 0.1031 , 0.1052 , 0.1006 , 0.1010 , 0.1007 , 0.1005 , 0.0961 , 0.0890 ]),
515+ ("xpu" , 5 ): np .array ([0.1118 , 0.1132 , 0.1153 , 0.1110 , 0.1112 , 0.1115 , 0.1108 , 0.1076 , 0.1016 ]),
516+ }
517+ )
518+ expected_slice = expected_slices .get_expectation ()
519+ # fmt: on
520+
451521 self ._test_marigold_depth (
452522 is_fp16 = True ,
453523 device = torch_device ,
454524 generator_seed = 0 ,
455- expected_slice = np . array ([ 0.1121 , 0.1135 , 0.1155 , 0.1111 , 0.1115 , 0.1118 , 0.1111 , 0.1079 , 0.1019 ]) ,
525+ expected_slice = expected_slice ,
456526 num_inference_steps = 1 ,
457527 processing_resolution = 768 ,
458528 ensemble_size = 4 ,
@@ -462,11 +532,21 @@ def test_marigold_depth_einstein_f16_accelerator_G0_S1_P768_E4_B2_M1(self):
462532 )
463533
464534 def test_marigold_depth_einstein_f16_accelerator_G0_S1_P512_E1_B1_M0 (self ):
535+ # fmt: off
536+ expected_slices = Expectations (
537+ {
538+ ("cuda" , 7 ): np .array ([0.2671 , 0.2690 , 0.2720 , 0.2659 , 0.2676 , 0.2739 , 0.2664 , 0.2686 , 0.2573 ]),
539+ ("xpu" , 3 ): np .array ([0.2671 , 0.2686 , 0.2715 , 0.2656 , 0.2671 , 0.2734 , 0.2661 , 0.2681 , 0.2573 ]),
540+ ("xpu" , 5 ): np .array ([0.2671 , 0.2690 , 0.2720 , 0.2659 , 0.2676 , 0.2739 , 0.2664 , 0.2686 , 0.2576 ]),
541+ }
542+ )
543+ expected_slice = expected_slices .get_expectation ()
544+ # fmt: on
465545 self ._test_marigold_depth (
466546 is_fp16 = True ,
467547 device = torch_device ,
468548 generator_seed = 0 ,
469- expected_slice = np . array ([ 0.2671 , 0.2690 , 0.2720 , 0.2659 , 0.2676 , 0.2739 , 0.2664 , 0.2686 , 0.2573 ]) ,
549+ expected_slice = expected_slice ,
470550 num_inference_steps = 1 ,
471551 processing_resolution = 512 ,
472552 ensemble_size = 1 ,
0 commit comments