"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "869bfb67ac55c2a2825488403bf3c15706190f8b"
Unverified Commit 38cd6b39 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix wording in query_chw (#6471)

parent 3bb4441b
...@@ -33,16 +33,16 @@ def get_chw(image: Union[PIL.Image.Image, torch.Tensor, features.Image]) -> Tupl ...@@ -33,16 +33,16 @@ def get_chw(image: Union[PIL.Image.Image, torch.Tensor, features.Image]) -> Tupl
def query_chw(sample: Any) -> Tuple[int, int, int]: def query_chw(sample: Any) -> Tuple[int, int, int]:
flat_sample, _ = tree_flatten(sample) flat_sample, _ = tree_flatten(sample)
image_dimensionss = { chws = {
get_chw(item) get_chw(item)
for item in flat_sample for item in flat_sample
if isinstance(item, (features.Image, PIL.Image.Image)) or is_simple_tensor(item) if isinstance(item, (features.Image, PIL.Image.Image)) or is_simple_tensor(item)
} }
if not image_dimensionss: if not chws:
raise TypeError("No image was found in the sample") raise TypeError("No image was found in the sample")
elif len(image_dimensionss) > 2: elif len(chws) > 2:
raise TypeError(f"Found multiple image dimensions in the sample: {sequence_to_str(sorted(image_dimensionss))}") raise TypeError(f"Found multiple CxHxW dimensions in the sample: {sequence_to_str(sorted(chws))}")
return image_dimensionss.pop() return chws.pop()
def has_any(sample: Any, *types_or_checks: Union[Type, Callable[[Any], bool]]) -> bool: def has_any(sample: Any, *types_or_checks: Union[Type, Callable[[Any], bool]]) -> bool:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment