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
Fairseq
Commits
8300a521
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "a65ca8a05974d079a72c736ea60721d01375b13b"
Commit
8300a521
authored
May 09, 2018
by
ngimel
Committed by
Myle Ott
Jun 15, 2018
Browse files
use implicit padding when possible
parent
ae2585d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
fairseq/models/fconv.py
fairseq/models/fconv.py
+3
-3
No files found.
fairseq/models/fconv.py
View file @
8300a521
...
...
@@ -123,9 +123,9 @@ class FConvEncoder(FairseqEncoder):
self
.
projections
.
append
(
Linear
(
in_channels
,
out_channels
)
if
in_channels
!=
out_channels
else
None
)
if
kernel_size
%
2
==
1
:
padding
=
kernel_size
//
2
padding
=
kernel_size
//
2
else
:
padding
=
0
padding
=
0
self
.
convolutions
.
append
(
ConvTBC
(
in_channels
,
out_channels
*
2
,
kernel_size
,
dropout
=
dropout
,
padding
=
padding
)
...
...
@@ -161,7 +161,7 @@ class FConvEncoder(FairseqEncoder):
if
conv
.
kernel_size
[
0
]
%
2
==
1
:
# padding is implicit in the conv
x
=
conv
(
x
)
else
:
else
:
padding_l
=
(
conv
.
kernel_size
[
0
]
-
1
)
//
2
padding_r
=
conv
.
kernel_size
[
0
]
//
2
x
=
F
.
pad
(
x
,
(
0
,
0
,
0
,
0
,
padding_l
,
padding_r
))
...
...
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