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
chenpangpang
transformers
Commits
a1a67a3c
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "c65633156b29482256619ee6515ba3d6c24578aa"
Unverified
Commit
a1a67a3c
authored
Feb 03, 2021
by
abhishek thakur
Committed by
GitHub
Feb 03, 2021
Browse files
Fix GroupedLinearLayer in TF ConvBERT (#9972)
parent
71bdc076
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/transformers/models/convbert/modeling_tf_convbert.py
src/transformers/models/convbert/modeling_tf_convbert.py
+4
-3
No files found.
src/transformers/models/convbert/modeling_tf_convbert.py
View file @
a1a67a3c
...
...
@@ -435,9 +435,10 @@ class GroupedLinearLayer(tf.keras.layers.Layer):
)
def
call
(
self
,
hidden_states
):
batch_size
=
shape_list
(
tensor
=
hidden_states
)[
1
]
x
=
tf
.
reshape
(
hidden_states
,
[
-
1
,
self
.
num_groups
,
self
.
group_in_dim
])
x
=
tf
.
matmul
(
a
=
x
,
b
=
self
.
kernel
,
transpose_b
=
True
)
batch_size
=
shape_list
(
hidden_states
)[
0
]
x
=
tf
.
transpose
(
tf
.
reshape
(
hidden_states
,
[
-
1
,
self
.
num_groups
,
self
.
group_in_dim
]),
[
1
,
0
,
2
])
x
=
tf
.
matmul
(
x
,
self
.
kernel
)
x
=
tf
.
transpose
(
x
,
[
1
,
0
,
2
])
x
=
tf
.
reshape
(
x
,
[
batch_size
,
-
1
,
self
.
output_size
])
x
=
tf
.
nn
.
bias_add
(
value
=
x
,
bias
=
self
.
bias
)
return
x
...
...
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