MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / resize

Function resize

PATH/core/models/decoders/pose_decodes/pose_decoder.py:45–66  ·  view source on GitHub ↗
(input,
           size=None,
           scale_factor=None,
           mode='nearest',
           align_corners=None,
           warning=True)

Source from the content-addressed store, hash-verified

43 return x
44
45def resize(input,
46 size=None,
47 scale_factor=None,
48 mode='nearest',
49 align_corners=None,
50 warning=True):
51 if warning:
52 if size is not None and align_corners:
53 input_h, input_w = tuple(int(x) for x in input.shape[2:])
54 output_h, output_w = tuple(int(x) for x in size)
55 if output_h > input_h or output_w > output_h:
56 if ((output_h > 1 and output_w > 1 and input_h > 1
57 and input_w > 1) and (output_h - 1) % (input_h - 1)
58 and (output_w - 1) % (input_w - 1)):
59 warnings.warn(
60 f'When align_corners={align_corners}, '
61 'the output would more aligned if '
62 f'input size {(input_h, input_w)} is `x+1` and '
63 f'out size {(output_h, output_w)} is `nx+1`')
64 if isinstance(size, torch.Size):
65 size = tuple(int(x) for x in size)
66 return F.interpolate(input, size, scale_factor, mode, align_corners)
67
68__all__ = ['TopDownSimpleHead']
69

Callers 1

_transform_inputsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected