Unverified Commit ae87c1e4 authored by Vasilis Vryniotis's avatar Vasilis Vryniotis Committed by GitHub
Browse files

Update to clang-format 11. (#3254)

parent 7bf6e7b1
...@@ -62,7 +62,8 @@ class PSROIAlignFunction ...@@ -62,7 +62,8 @@ class PSROIAlignFunction
input_shape[2], input_shape[2],
input_shape[3]); input_shape[3]);
return {grad_in, return {
grad_in,
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
......
...@@ -53,7 +53,8 @@ class PSROIPoolFunction : public torch::autograd::Function<PSROIPoolFunction> { ...@@ -53,7 +53,8 @@ class PSROIPoolFunction : public torch::autograd::Function<PSROIPoolFunction> {
input_shape[2], input_shape[2],
input_shape[3]); input_shape[3]);
return {grad_in, return {
grad_in,
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
......
...@@ -57,7 +57,8 @@ class ROIAlignFunction : public torch::autograd::Function<ROIAlignFunction> { ...@@ -57,7 +57,8 @@ class ROIAlignFunction : public torch::autograd::Function<ROIAlignFunction> {
input_shape[3], input_shape[3],
ctx->saved_data["sampling_ratio"].toInt(), ctx->saved_data["sampling_ratio"].toInt(),
ctx->saved_data["aligned"].toBool()); ctx->saved_data["aligned"].toBool());
return {grad_in, return {
grad_in,
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
......
...@@ -53,7 +53,8 @@ class ROIPoolFunction : public torch::autograd::Function<ROIPoolFunction> { ...@@ -53,7 +53,8 @@ class ROIPoolFunction : public torch::autograd::Function<ROIPoolFunction> {
input_shape[2], input_shape[2],
input_shape[3]); input_shape[3]);
return {grad_in, return {
grad_in,
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
torch::autograd::Variable(), torch::autograd::Variable(),
......
...@@ -634,24 +634,28 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -634,24 +634,28 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
input = input.reshape( input = input.reshape(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
grad_offset = grad_offset.reshape({batch_sz / n_parallel_imgs, grad_offset = grad_offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
offset = offset.reshape({batch_sz / n_parallel_imgs, offset = offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
grad_mask = grad_mask.reshape({batch_sz / n_parallel_imgs, grad_mask = grad_mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
mask = mask.reshape({batch_sz / n_parallel_imgs, mask = mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
...@@ -659,7 +663,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -659,7 +663,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
} }
grad_out = grad_out grad_out = grad_out
.reshape({batch_sz / n_parallel_imgs, .reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_weight_grps, n_weight_grps,
n_out_channels / n_weight_grps, n_out_channels / n_weight_grps,
...@@ -667,7 +672,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -667,7 +672,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
out_w}) out_w})
.permute({0, 2, 3, 1, 4, 5}); .permute({0, 2, 3, 1, 4, 5});
weight = weight.reshape({n_weight_grps, weight = weight.reshape(
{n_weight_grps,
weight.size(0) / n_weight_grps, weight.size(0) / n_weight_grps,
weight.size(1), weight.size(1),
weight.size(2), weight.size(2),
...@@ -775,7 +781,8 @@ at::Tensor backward_gradient_parameters( ...@@ -775,7 +781,8 @@ at::Tensor backward_gradient_parameters(
} }
at::Tensor grad_out_buf = grad_out at::Tensor grad_out_buf = grad_out
.reshape({batch_sz / n_parallel_imgs, .reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_weight_grps, n_weight_grps,
n_out_channels / n_weight_grps, n_out_channels / n_weight_grps,
...@@ -787,21 +794,24 @@ at::Tensor backward_gradient_parameters( ...@@ -787,21 +794,24 @@ at::Tensor backward_gradient_parameters(
input = input.reshape( input = input.reshape(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
offset = offset.reshape({batch_sz / n_parallel_imgs, offset = offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
mask = mask.reshape({batch_sz / n_parallel_imgs, mask = mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
} }
grad_weight = grad_weight.view({n_weight_grps, grad_weight = grad_weight.view(
{n_weight_grps,
grad_weight.size(0) / n_weight_grps, grad_weight.size(0) / n_weight_grps,
grad_weight.size(1), grad_weight.size(1),
grad_weight.size(2), grad_weight.size(2),
...@@ -846,7 +856,8 @@ at::Tensor backward_gradient_parameters( ...@@ -846,7 +856,8 @@ at::Tensor backward_gradient_parameters(
} }
} }
grad_weight = grad_weight.view({grad_weight.size(0) * grad_weight.size(1), grad_weight = grad_weight.view(
{grad_weight.size(0) * grad_weight.size(1),
grad_weight.size(2), grad_weight.size(2),
grad_weight.size(3), grad_weight.size(3),
grad_weight.size(4)}); grad_weight.size(4)});
...@@ -976,7 +987,8 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -976,7 +987,8 @@ at::Tensor deform_conv2d_forward_kernel(
} }
// Separate batches into blocks // Separate batches into blocks
out = out.view({batch_sz / n_parallel_imgs, out = out.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
out_channels, out_channels,
out_h, out_h,
...@@ -984,14 +996,16 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -984,14 +996,16 @@ at::Tensor deform_conv2d_forward_kernel(
input_c = input_c.view( input_c = input_c.view(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
offset_c = offset_c.view({batch_sz / n_parallel_imgs, offset_c = offset_c.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
mask_c = mask_c.view({batch_sz / n_parallel_imgs, mask_c = mask_c.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
...@@ -1006,12 +1020,14 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1006,12 +1020,14 @@ at::Tensor deform_conv2d_forward_kernel(
out.options()); out.options());
// Separate channels into convolution groups // Separate channels into convolution groups
out_buf = out_buf.view({out_buf.size(0), out_buf = out_buf.view(
{out_buf.size(0),
n_weight_grps, n_weight_grps,
out_buf.size(1) / n_weight_grps, out_buf.size(1) / n_weight_grps,
out_buf.size(2), out_buf.size(2),
out_buf.size(3)}); out_buf.size(3)});
weight_c = weight_c.view({n_weight_grps, weight_c = weight_c.view(
{n_weight_grps,
weight_c.size(0) / n_weight_grps, weight_c.size(0) / n_weight_grps,
weight_c.size(1), weight_c.size(1),
weight_c.size(2), weight_c.size(2),
...@@ -1056,7 +1072,8 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1056,7 +1072,8 @@ at::Tensor deform_conv2d_forward_kernel(
columns.view({columns.size(0) * columns.size(1), columns.size(2)}); columns.view({columns.size(0) * columns.size(1), columns.size(2)});
} }
out_buf = out_buf.view({batch_sz / n_parallel_imgs, out_buf = out_buf.view(
{batch_sz / n_parallel_imgs,
out_channels, out_channels,
n_parallel_imgs, n_parallel_imgs,
out_h, out_h,
......
...@@ -677,24 +677,28 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -677,24 +677,28 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
input = input.reshape( input = input.reshape(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
grad_offset = grad_offset.reshape({batch_sz / n_parallel_imgs, grad_offset = grad_offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
offset = offset.reshape({batch_sz / n_parallel_imgs, offset = offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
grad_mask = grad_mask.reshape({batch_sz / n_parallel_imgs, grad_mask = grad_mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
mask = mask.reshape({batch_sz / n_parallel_imgs, mask = mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
...@@ -702,7 +706,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -702,7 +706,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
} }
grad_out = grad_out grad_out = grad_out
.reshape({batch_sz / n_parallel_imgs, .reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_weight_grps, n_weight_grps,
n_out_channels / n_weight_grps, n_out_channels / n_weight_grps,
...@@ -710,7 +715,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs( ...@@ -710,7 +715,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> backward_gradient_inputs(
out_w}) out_w})
.permute({0, 2, 3, 1, 4, 5}); .permute({0, 2, 3, 1, 4, 5});
weight = weight.reshape({n_weight_grps, weight = weight.reshape(
{n_weight_grps,
weight.size(0) / n_weight_grps, weight.size(0) / n_weight_grps,
weight.size(1), weight.size(1),
weight.size(2), weight.size(2),
...@@ -819,7 +825,8 @@ at::Tensor backward_gradient_parameters( ...@@ -819,7 +825,8 @@ at::Tensor backward_gradient_parameters(
} }
at::Tensor grad_out_buf = grad_out at::Tensor grad_out_buf = grad_out
.reshape({batch_sz / n_parallel_imgs, .reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_weight_grps, n_weight_grps,
n_out_channels / n_weight_grps, n_out_channels / n_weight_grps,
...@@ -831,21 +838,24 @@ at::Tensor backward_gradient_parameters( ...@@ -831,21 +838,24 @@ at::Tensor backward_gradient_parameters(
input = input.reshape( input = input.reshape(
{batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, n_in_channels, in_h, in_w});
offset = offset.reshape({batch_sz / n_parallel_imgs, offset = offset.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
mask = mask.reshape({batch_sz / n_parallel_imgs, mask = mask.reshape(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
} }
grad_weight = grad_weight.reshape({n_weight_grps, grad_weight = grad_weight.reshape(
{n_weight_grps,
grad_weight.size(0) / n_weight_grps, grad_weight.size(0) / n_weight_grps,
grad_weight.size(1), grad_weight.size(1),
grad_weight.size(2), grad_weight.size(2),
...@@ -890,7 +900,8 @@ at::Tensor backward_gradient_parameters( ...@@ -890,7 +900,8 @@ at::Tensor backward_gradient_parameters(
} }
} }
grad_weight = grad_weight.view({grad_weight.size(0) * grad_weight.size(1), grad_weight = grad_weight.view(
{grad_weight.size(0) * grad_weight.size(1),
grad_weight.size(2), grad_weight.size(2),
grad_weight.size(3), grad_weight.size(3),
grad_weight.size(4)}); grad_weight.size(4)});
...@@ -1021,7 +1032,8 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1021,7 +1032,8 @@ at::Tensor deform_conv2d_forward_kernel(
} }
// Separate batches into blocks // Separate batches into blocks
out = out.view({batch_sz / n_parallel_imgs, out = out.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
out_channels, out_channels,
out_h, out_h,
...@@ -1029,14 +1041,16 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1029,14 +1041,16 @@ at::Tensor deform_conv2d_forward_kernel(
input_c = input_c.view( input_c = input_c.view(
{batch_sz / n_parallel_imgs, n_parallel_imgs, in_channels, in_h, in_w}); {batch_sz / n_parallel_imgs, n_parallel_imgs, in_channels, in_h, in_w});
offset_c = offset_c.view({batch_sz / n_parallel_imgs, offset_c = offset_c.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * 2 * weight_h * weight_w, n_offset_grps * 2 * weight_h * weight_w,
out_h, out_h,
out_w}); out_w});
if (use_mask) { if (use_mask) {
mask_c = mask_c.view({batch_sz / n_parallel_imgs, mask_c = mask_c.view(
{batch_sz / n_parallel_imgs,
n_parallel_imgs, n_parallel_imgs,
n_offset_grps * weight_h * weight_w, n_offset_grps * weight_h * weight_w,
out_h, out_h,
...@@ -1051,12 +1065,14 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1051,12 +1065,14 @@ at::Tensor deform_conv2d_forward_kernel(
out.options()); out.options());
// Separate channels into convolution groups // Separate channels into convolution groups
out_buf = out_buf.view({out_buf.size(0), out_buf = out_buf.view(
{out_buf.size(0),
n_weight_grps, n_weight_grps,
out_buf.size(1) / n_weight_grps, out_buf.size(1) / n_weight_grps,
out_buf.size(2), out_buf.size(2),
out_buf.size(3)}); out_buf.size(3)});
weight_c = weight_c.view({n_weight_grps, weight_c = weight_c.view(
{n_weight_grps,
weight_c.size(0) / n_weight_grps, weight_c.size(0) / n_weight_grps,
weight_c.size(1), weight_c.size(1),
weight_c.size(2), weight_c.size(2),
...@@ -1101,7 +1117,8 @@ at::Tensor deform_conv2d_forward_kernel( ...@@ -1101,7 +1117,8 @@ at::Tensor deform_conv2d_forward_kernel(
columns.view({columns.size(0) * columns.size(1), columns.size(2)}); columns.view({columns.size(0) * columns.size(1), columns.size(2)});
} }
out_buf = out_buf.view({batch_sz / n_parallel_imgs, out_buf = out_buf.view(
{batch_sz / n_parallel_imgs,
out_channels, out_channels,
n_parallel_imgs, n_parallel_imgs,
out_h, out_h,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment