Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
c42fe0b6
Unverified
Commit
c42fe0b6
authored
Aug 13, 2025
by
TeeKen Lau
Committed by
GitHub
Aug 12, 2025
Browse files
Add more test scenario for tensor schema (#22733)
Signed-off-by:
teekenl
<
teekenlau@gmail.com
>
parent
5a4b4b37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
tests/utils_/test_tensor_schema.py
tests/utils_/test_tensor_schema.py
+25
-0
No files found.
tests/utils_/test_tensor_schema.py
View file @
c42fe0b6
...
@@ -33,6 +33,31 @@ def test_tensor_schema_constant_dim_failure():
...
@@ -33,6 +33,31 @@ def test_tensor_schema_constant_dim_failure():
)
)
def
test_tensor_schema_invalid_types_in_list
():
with
pytest
.
raises
(
ValueError
,
match
=
"is not a torch.Tensor"
):
Phi3VImagePixelInputs
(
data
=
[
torch
.
randn
(
64
,
3
,
32
,
32
),
"not_a_tensor"
,
torch
.
randn
(
64
,
3
,
32
,
32
),
],
image_sizes
=
torch
.
randint
(
0
,
256
,
(
3
,
2
)),
)
def
test_tensor_schema_rank_mismatch
():
with
pytest
.
raises
(
ValueError
,
match
=
"has rank 3 but expected 5"
):
Phi3VImagePixelInputs
(
data
=
torch
.
randn
(
16
,
64
,
3
),
image_sizes
=
torch
.
randint
(
0
,
256
,
(
16
,
2
)),
)
def
test_tensor_schema_missing_required_field
():
with
pytest
.
raises
(
ValueError
,
match
=
"Required field 'data' is missing"
):
Phi3VImagePixelInputs
(
image_sizes
=
torch
.
randint
(
0
,
256
,
(
16
,
2
)),
)
def
test_tensor_schema_symbolic_dim_mismatch
():
def
test_tensor_schema_symbolic_dim_mismatch
():
with
pytest
.
raises
(
ValueError
,
match
=
"expected 'bn'=12, got 16"
):
with
pytest
.
raises
(
ValueError
,
match
=
"expected 'bn'=12, got 16"
):
Phi3VImagePixelInputs
(
Phi3VImagePixelInputs
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment