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
gaoqiong
composable_kernel
Commits
f75931c1
Commit
f75931c1
authored
Nov 09, 2022
by
Qianfeng Zhang
Browse files
Update to comments and codes format
parent
7fb23099
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
example/34_batchnorm/batchnorm_backward_nhwc.cpp
example/34_batchnorm/batchnorm_backward_nhwc.cpp
+12
-18
No files found.
example/34_batchnorm/batchnorm_backward_nhwc.cpp
View file @
f75931c1
...
...
@@ -39,23 +39,16 @@ class BatchNormBwdArg
public:
void
show_usage
(
const
char
*
cmd
)
{
// clang-format off
std
::
cout
<<
"Usage of "
<<
cmd
<<
std
::
endl
;
std
::
cout
<<
"--inOutLengths or -D, comma separated list of input tensor dimension "
"lengths, must have 4 integers for nhwc"
<<
std
::
endl
;
std
::
cout
<<
"--verify or -v, 1/0 to indicate whether to verify the batch-normalization "
"result by "
"comparing with the host-based batch-normalization"
<<
std
::
endl
;
std
::
cout
<<
"--inOutLengths or -D, comma separated list of input tensor dimension lengths, must have 4 integers for nhwc"
<<
std
::
endl
;
std
::
cout
<<
"--verify or -v, 1/0 to indicate whether to verify the result by comparing with the host-based batch-normalization"
<<
std
::
endl
;
std
::
cout
<<
"Arg1: data type (0: fp16, 1: fp32, 3: int8, 5: bp16, 6: fp64)"
<<
std
::
endl
;
std
::
cout
<<
"Arg2 -- 1/0 to indicate whether to use saved mean and invVariance"
<<
std
::
endl
;
std
::
cout
<<
"Arg3 -- init method used for dy and bnScale (0=no init, 1=single integer "
"value, 2=scope integer "
"value, 3=decimal value)"
<<
std
::
endl
;
std
::
cout
<<
"Arg2 -- 1/0 to indicate whether to use saved mean and invVariance"
<<
std
::
endl
;
std
::
cout
<<
"Arg3 -- init method used for dy and bnScale (0=no init, 1=single integer value, 2=scope integer value, 3=decimal value)"
<<
std
::
endl
;
std
::
cout
<<
"Arg4 -- time kernel (0=no, 1=yes)"
<<
std
::
endl
;
std
::
cout
<<
"Arg5: use multi-block welford (0=n0, 1=yes)"
<<
std
::
endl
;
// clang-format on
};
int
processArgs
(
int
argc
,
char
*
argv
[])
...
...
@@ -329,7 +322,7 @@ bool bnorm_bwd_nhwc_test(bool do_verification,
avg_time
=
invoker_ptr
->
Run
(
argument_ptr
.
get
(),
StreamConfig
{
nullptr
,
time_kernel
});
// inputing of x, dy, scale, outputing of dx, scale
Diff
, bias
Diff
// inputing of x, dy, scale, outputing of dx,
d
scale,
d
bias
num_bytes
+=
total_length
*
sizeof
(
InOutDataType
)
*
3
+
invariant_length
*
sizeof
(
AccDataType
)
*
3
;
...
...
@@ -395,11 +388,12 @@ bool bnorm_bwd_nhwc_test(bool do_verification,
dx_dev
.
FromDevice
(
dx
.
mData
.
data
());
dscale_dev
.
FromDevice
(
dscale
.
data
());
dbias_dev
.
FromDevice
(
dbias
.
data
());
pass
=
pass
&&
ck
::
utils
::
check_err
(
dbias
.
mData
,
dbias_ref
.
mData
,
"dBias result:"
,
1e-5
,
1e-5
);
pass
=
pass
&&
ck
::
utils
::
check_err
(
dscale
.
mData
,
dscale_ref
.
mData
,
"dScale result:"
,
1e-5
,
2e-4
);
// clang-format off
pass
=
pass
&&
ck
::
utils
::
check_err
(
dbias
.
mData
,
dbias_ref
.
mData
,
"dBias result:"
,
1e-5
,
1e-5
);
pass
=
pass
&&
ck
::
utils
::
check_err
(
dscale
.
mData
,
dscale_ref
.
mData
,
"dScale result:"
,
1e-5
,
2e-4
);
pass
=
pass
&&
ck
::
utils
::
check_err
(
dx
.
mData
,
dx_ref
.
mData
,
"dx result:"
);
// clang-format on
};
return
(
pass
);
...
...
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