fix the code style of yapf 0.29 (#150)

* fix the code style of yapf 0.29

* fix flake8
This commit is contained in:
Kai Chen 2019-12-02 13:14:33 +08:00 committed by GitHub
parent 56971278db
commit 0eef3757e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 12 deletions

View File

@ -153,8 +153,8 @@ def imcrop(img, bboxes, scale=1.0, pad_fill=None):
y_start = 0 if _y1 >= 0 else -_y1
w = x2 - x1 + 1
h = y2 - y1 + 1
patch[y_start:y_start + h, x_start:x_start +
w, ...] = img[y1:y1 + h, x1:x1 + w, ...]
patch[y_start:y_start + h, x_start:x_start + w,
...] = img[y1:y1 + h, x1:x1 + w, ...]
patches.append(patch)
if bboxes.ndim == 1:

View File

@ -9,7 +9,10 @@ from .scatter_gather import scatter_kwargs
class MMDistributedDataParallel(nn.Module):
def __init__(self, module, dim=0, broadcast_buffers=True,
def __init__(self,
module,
dim=0,
broadcast_buffers=True,
bucket_cap_mb=25):
super(MMDistributedDataParallel, self).__init__()
self.module = module

View File

@ -296,7 +296,9 @@ class Runner(object):
self.call_hook('after_val_epoch')
def resume(self, checkpoint, resume_optimizer=True,
def resume(self,
checkpoint,
resume_optimizer=True,
map_location='default'):
if map_location == 'default':
device_id = torch.cuda.current_device()

View File

@ -140,7 +140,7 @@ def check_prerequisites(
prerequisites,
checker,
msg_tmpl='Prerequisites "{}" are required in method "{}" but not '
'found, please install them first.'):
'found, please install them first.'): # yapf: disable
"""A decorator factory to check if prerequisites are satisfied.
Args:

View File

@ -7,7 +7,10 @@ from mmcv.utils import requires_executable
@requires_executable('ffmpeg')
def convert_video(in_file, out_file, print_cmd=False, pre_options='',
def convert_video(in_file,
out_file,
print_cmd=False,
pre_options='',
**kwargs):
"""Convert a video with ffmpeg.

View File

@ -119,10 +119,10 @@ def test_dequantize_flow():
ref = np.zeros_like(flow, dtype=np.float32)
for i in range(ref.shape[0]):
for j in range(ref.shape[1]):
ref[i, j, 0] = (float(dx[i, j] + 0.5) * 2 * max_val / 255 -
max_val) * w
ref[i, j, 1] = (float(dy[i, j] + 0.5) * 2 * max_val / 255 -
max_val) * h
ref[i, j,
0] = (float(dx[i, j] + 0.5) * 2 * max_val / 255 - max_val) * w
ref[i, j,
1] = (float(dy[i, j] + 0.5) * 2 * max_val / 255 - max_val) * h
assert_array_almost_equal(flow, ref)
@ -156,8 +156,8 @@ def test_flow_warp():
sy = np.floor(dy).astype(int)
valid = (sx >= 0) & (sx < height - 1) & (sy >= 0) & (sy < width - 1)
output[valid, :] = img[dx[valid].round().astype(int), dy[valid].round(
).astype(int), :]
output[valid, :] = img[dx[valid].round().astype(int),
dy[valid].round().astype(int), :]
return output