pytorch/torch/nn/modules/utils.py
Sam Gross cd0929aa5e Use chainer-style constructor for Conv2d
* Conv2d, MaxPool2d, and AvgPool2d have one argument for each of ksize,
   stride, and pad. This argument can be either a single number or a
   tuple of (h, w)
2016-09-07 15:51:44 -07:00

7 lines
111 B
Python

import collections
def _pair(x):
if isinstance(x, collections.Iterable):
return x
return x, x