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
bd7c1a0f
Commit
bd7c1a0f
authored
Mar 14, 2022
by
Thor Johnsen
Browse files
Leave bottleneck masks as bool
parent
7e1c22d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
apex/contrib/bottleneck/bottleneck.py
apex/contrib/bottleneck/bottleneck.py
+2
-2
No files found.
apex/contrib/bottleneck/bottleneck.py
View file @
bd7c1a0f
...
@@ -36,14 +36,14 @@ class FrozenBatchNorm2d(torch.nn.Module):
...
@@ -36,14 +36,14 @@ class FrozenBatchNorm2d(torch.nn.Module):
@
torch
.
jit
.
script
@
torch
.
jit
.
script
def
drelu_dscale1
(
grad_o
,
output
,
scale1
):
def
drelu_dscale1
(
grad_o
,
output
,
scale1
):
relu_mask
=
(
output
>
0
)
.
half
()
relu_mask
=
(
output
>
0
)
dx_relu
=
relu_mask
*
grad_o
dx_relu
=
relu_mask
*
grad_o
g1
=
dx_relu
*
scale1
g1
=
dx_relu
*
scale1
return
g1
,
dx_relu
return
g1
,
dx_relu
@
torch
.
jit
.
script
@
torch
.
jit
.
script
def
drelu_dscale2
(
grad_o
,
output
,
scale1
,
scale2
):
def
drelu_dscale2
(
grad_o
,
output
,
scale1
,
scale2
):
relu_mask
=
(
output
>
0
)
.
half
()
relu_mask
=
(
output
>
0
)
dx_relu
=
relu_mask
*
grad_o
dx_relu
=
relu_mask
*
grad_o
g1
=
dx_relu
*
scale1
g1
=
dx_relu
*
scale1
g2
=
dx_relu
*
scale2
g2
=
dx_relu
*
scale2
...
...
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