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
vision
Commits
5fb36a17
Unverified
Commit
5fb36a17
authored
Sep 06, 2021
by
Vasilis Vryniotis
Committed by
GitHub
Sep 06, 2021
Browse files
Resolving tracing problem on StochasticDepth iterator. (#4372)
Co-authored-by:
Francisco Massa
<
fvsmassa@gmail.com
>
parent
6ce278bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
torchvision/ops/stochastic_depth.py
torchvision/ops/stochastic_depth.py
+3
-2
No files found.
torchvision/ops/stochastic_depth.py
View file @
5fb36a17
...
...
@@ -28,9 +28,10 @@ def stochastic_depth(input: Tensor, p: float, mode: str, training: bool = True)
return
input
survival_rate
=
1.0
-
p
size
=
[
1
]
*
input
.
ndim
if
mode
==
"row"
:
size
[
0
]
=
input
.
shape
[
0
]
size
=
[
input
.
shape
[
0
]]
+
[
1
]
*
(
input
.
ndim
-
1
)
else
:
size
=
[
1
]
*
input
.
ndim
noise
=
torch
.
empty
(
size
,
dtype
=
input
.
dtype
,
device
=
input
.
device
)
noise
=
noise
.
bernoulli_
(
survival_rate
).
div_
(
survival_rate
)
return
input
*
noise
...
...
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