Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
d81ed26d
Unverified
Commit
d81ed26d
authored
Feb 04, 2019
by
mcarilli
Committed by
GitHub
Feb 04, 2019
Browse files
Merge pull request #143 from NVIDIA/sbn_no_affine
allowing syncBN to run with affine = False
parents
48299b0d
223a47e9
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
66 deletions
+119
-66
csrc/syncbn.cpp
csrc/syncbn.cpp
+8
-8
csrc/welford.cu
csrc/welford.cu
+111
-58
No files found.
csrc/syncbn.cpp
View file @
d81ed26d
...
@@ -21,8 +21,8 @@ std::vector<at::Tensor> welford_parallel_CUDA(const at::Tensor mean_feature_node
...
@@ -21,8 +21,8 @@ std::vector<at::Tensor> welford_parallel_CUDA(const at::Tensor mean_feature_node
at
::
Tensor
batchnorm_forward_CUDA
(
const
at
::
Tensor
input
,
at
::
Tensor
batchnorm_forward_CUDA
(
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
,
const
at
::
optional
<
at
::
Tensor
>
weight
,
const
at
::
Tensor
shift
);
const
at
::
optional
<
at
::
Tensor
>
shift
);
// backward BN operation, returns {mean_dy, mean_dy_xmu, grad_weight, grad_bias}
// backward BN operation, returns {mean_dy, mean_dy_xmu, grad_weight, grad_bias}
// grad_output/input should have identical data type;
// grad_output/input should have identical data type;
...
@@ -32,7 +32,7 @@ std::vector<at::Tensor> reduce_bn_CUDA(const at::Tensor grad_output,
...
@@ -32,7 +32,7 @@ std::vector<at::Tensor> reduce_bn_CUDA(const at::Tensor grad_output,
const
at
::
Tensor
input
,
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
);
const
at
::
optional
<
at
::
Tensor
>
weight
);
// elementwise backward BN operation, returns grad_input
// elementwise backward BN operation, returns grad_input
// grad_output/input/weight precision could be fp16/fp32;
// grad_output/input/weight precision could be fp16/fp32;
...
@@ -41,7 +41,7 @@ at::Tensor batchnorm_backward_CUDA(const at::Tensor grad_output,
...
@@ -41,7 +41,7 @@ at::Tensor batchnorm_backward_CUDA(const at::Tensor grad_output,
const
at
::
Tensor
input
,
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
,
const
at
::
optional
<
at
::
Tensor
>
weight
,
const
at
::
Tensor
mean_dy
,
const
at
::
Tensor
mean_dy
,
const
at
::
Tensor
mean_dy_xmu
);
const
at
::
Tensor
mean_dy_xmu
);
...
@@ -57,8 +57,8 @@ std::vector<at::Tensor> welford_mean_var_c_last_CUDA(const at::Tensor input);
...
@@ -57,8 +57,8 @@ std::vector<at::Tensor> welford_mean_var_c_last_CUDA(const at::Tensor input);
at
::
Tensor
batchnorm_forward_c_last_CUDA
(
const
at
::
Tensor
input
,
at
::
Tensor
batchnorm_forward_c_last_CUDA
(
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
,
const
at
::
optional
<
at
::
Tensor
>
weight
,
const
at
::
Tensor
shift
);
const
at
::
optional
<
at
::
Tensor
>
shift
);
// backward BN operation, returns {mean_dy, mean_dy_xmu, grad_weight, grad_bias}
// backward BN operation, returns {mean_dy, mean_dy_xmu, grad_weight, grad_bias}
// grad_output/input should have identical data type;
// grad_output/input should have identical data type;
...
@@ -68,7 +68,7 @@ std::vector<at::Tensor> reduce_bn_c_last_CUDA(const at::Tensor grad_output,
...
@@ -68,7 +68,7 @@ std::vector<at::Tensor> reduce_bn_c_last_CUDA(const at::Tensor grad_output,
const
at
::
Tensor
input
,
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
);
const
at
::
optional
<
at
::
Tensor
>
weight
);
// elementwise backward BN operation, returns grad_input
// elementwise backward BN operation, returns grad_input
// grad_output/input/weight precision could be fp16/fp32;
// grad_output/input/weight precision could be fp16/fp32;
...
@@ -78,7 +78,7 @@ at::Tensor batchnorm_backward_c_last_CUDA(const at::Tensor grad_output,
...
@@ -78,7 +78,7 @@ at::Tensor batchnorm_backward_c_last_CUDA(const at::Tensor grad_output,
const
at
::
Tensor
input
,
const
at
::
Tensor
input
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
mean
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
inv_std
,
const
at
::
Tensor
weight
,
const
at
::
optional
<
at
::
Tensor
>
weight
,
const
at
::
Tensor
mean_dy
,
const
at
::
Tensor
mean_dy
,
const
at
::
Tensor
mean_dy_xmu
);
const
at
::
Tensor
mean_dy_xmu
);
...
...
csrc/welford.cu
View file @
d81ed26d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment