@@ -33,6 +33,31 @@ def test_tensor_schema_constant_dim_failure():
33
33
)
34
34
35
35
36
+ def test_tensor_schema_invalid_types_in_list ():
37
+ with pytest .raises (ValueError , match = "is not a torch.Tensor" ):
38
+ Phi3VImagePixelInputs (
39
+ data = [
40
+ torch .randn (64 , 3 , 32 , 32 ),
41
+ "not_a_tensor" ,
42
+ torch .randn (64 , 3 , 32 , 32 ),
43
+ ],
44
+ image_sizes = torch .randint (0 , 256 , (3 , 2 )),
45
+ )
46
+
47
+
48
+ def test_tensor_schema_rank_mismatch ():
49
+ with pytest .raises (ValueError , match = "has rank 3 but expected 5" ):
50
+ Phi3VImagePixelInputs (
51
+ data = torch .randn (16 , 64 , 3 ),
52
+ image_sizes = torch .randint (0 , 256 , (16 , 2 )),
53
+ )
54
+
55
+
56
+ def test_tensor_schema_missing_required_field ():
57
+ with pytest .raises (ValueError , match = "Required field 'data' is missing" ):
58
+ Phi3VImagePixelInputs (image_sizes = torch .randint (0 , 256 , (16 , 2 )), )
59
+
60
+
36
61
def test_tensor_schema_symbolic_dim_mismatch ():
37
62
with pytest .raises (ValueError , match = "expected 'bn'=12, got 16" ):
38
63
Phi3VImagePixelInputs (
0 commit comments