File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
torchvision/transforms/v2 Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 22
33import collections .abc
44import numbers
5- from collections .abc import Iterable , Sequence
5+ from collections .abc import Sequence
66from contextlib import suppress
77
88from typing import Any , Callable , Literal
@@ -165,18 +165,16 @@ def get_bounding_boxes(flat_inputs: list[Any]) -> tv_tensors.BoundingBoxes:
165165 raise ValueError ("No bounding boxes were found in the sample" )
166166
167167
168- def get_all_keypoints (flat_inputs : list [Any ]) -> Iterable [ tv_tensors .KeyPoints ] :
169- """Yields all KeyPoints in the input.
168+ def get_keypoints (flat_inputs : list [Any ]) -> tv_tensors .KeyPoints :
169+ """Returns the KeyPoints in the input.
170170
171- Raises:
172- ValueError: No KeyPoints can be found
171+ Assumes only one ``KeyPoints`` object is present
173172 """
174173 generator = (inpt for inpt in flat_inputs if isinstance (inpt , tv_tensors .KeyPoints ))
175174 try :
176- yield next (generator )
175+ return next (generator )
177176 except StopIteration :
178177 raise ValueError ("No Keypoints were found in the sample." )
179- return generator
180178
181179
182180def query_chw (flat_inputs : list [Any ]) -> tuple [int , int , int ]:
You can’t perform that action at this time.
0 commit comments