@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / c42fe0b63a
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

Add more test scenario for tensor schema (#22733)

Signed-off-by: teekenl <teekenlau@gmail.com>

TeeKen Lau committed Aug 13, 2025 at 02:34 UTC c42fe0b63a29d3ec157089c9784643000dde4aec
1 file changed +25
tests/utils_/test_tensor_schema.py
+25
@@ -33,6 +33,31 @@ def test_tensor_schema_constant_dim_failure():
33 )
34
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 +
61 def test_tensor_schema_symbolic_dim_mismatch():
62 with pytest.raises(ValueError, match="expected 'bn'=12, got 16"):
63 Phi3VImagePixelInputs(