MCPcopy Create free account
hub / github.com/PeizeSun/TransTrack / _check_size_scale_factor

Function _check_size_scale_factor

util/misc.py:24–34  ·  view source on GitHub ↗
(dim, size, scale_factor)

Source from the content-addressed store, hash-verified

22 import math
23 from torchvision.ops.misc import _NewEmptyTensorOp
24 def _check_size_scale_factor(dim, size, scale_factor):
25 # type: (int, Optional[List[int]], Optional[float]) -> None
26 if size is None and scale_factor is None:
27 raise ValueError("either size or scale_factor should be defined")
28 if size is not None and scale_factor is not None:
29 raise ValueError("only one of size or scale_factor should be defined")
30 if not (scale_factor is not None and len(scale_factor) != dim):
31 raise ValueError(
32 "scale_factor shape must match input shape. "
33 "Input is {}D, scale_factor size is {}".format(dim, len(scale_factor))
34 )
35 def _output_size(dim, input, size, scale_factor):
36 # type: (int, Tensor, Optional[List[int]], Optional[float]) -> List[int]
37 assert dim == 2

Callers 1

_output_sizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected