# PyTorch 写法
torch.nn.modules.utils._pair(x)
# Paddle 写法
def _ntuple(n, name="parse"):
def parse(x):
if isinstance(x, collections.abc.Iterable):
return tuple(x)
return tuple(repeat(x, n))
parse.__name__ = name
return parse
_ntuple(n=2, name="parse")(x)