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
ModelZoo
ResNet50_tensorflow
Commits
bb124157
Commit
bb124157
authored
Mar 10, 2021
by
stephenwu
Browse files
Merge branch 'master' of
https://github.com/tensorflow/models
into RTESuperGLUE
parents
2e9bb539
0edeb7f6
Changes
386
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
43 additions
and
48 deletions
+43
-48
official/nlp/modeling/layers/mobile_bert_layers.py
official/nlp/modeling/layers/mobile_bert_layers.py
+2
-3
official/nlp/modeling/layers/mobile_bert_layers_test.py
official/nlp/modeling/layers/mobile_bert_layers_test.py
+3
-3
official/nlp/modeling/layers/multi_channel_attention.py
official/nlp/modeling/layers/multi_channel_attention.py
+2
-3
official/nlp/modeling/layers/multi_channel_attention_test.py
official/nlp/modeling/layers/multi_channel_attention_test.py
+2
-3
official/nlp/modeling/layers/on_device_embedding.py
official/nlp/modeling/layers/on_device_embedding.py
+2
-2
official/nlp/modeling/layers/position_embedding.py
official/nlp/modeling/layers/position_embedding.py
+2
-2
official/nlp/modeling/layers/position_embedding_test.py
official/nlp/modeling/layers/position_embedding_test.py
+2
-2
official/nlp/modeling/layers/relative_attention.py
official/nlp/modeling/layers/relative_attention.py
+2
-3
official/nlp/modeling/layers/relative_attention_test.py
official/nlp/modeling/layers/relative_attention_test.py
+2
-2
official/nlp/modeling/layers/rezero_transformer.py
official/nlp/modeling/layers/rezero_transformer.py
+2
-2
official/nlp/modeling/layers/rezero_transformer_test.py
official/nlp/modeling/layers/rezero_transformer_test.py
+2
-2
official/nlp/modeling/layers/self_attention_mask.py
official/nlp/modeling/layers/self_attention_mask.py
+2
-2
official/nlp/modeling/layers/talking_heads_attention.py
official/nlp/modeling/layers/talking_heads_attention.py
+2
-2
official/nlp/modeling/layers/talking_heads_attention_test.py
official/nlp/modeling/layers/talking_heads_attention_test.py
+2
-2
official/nlp/modeling/layers/text_layers.py
official/nlp/modeling/layers/text_layers.py
+4
-5
official/nlp/modeling/layers/text_layers_test.py
official/nlp/modeling/layers/text_layers_test.py
+2
-2
official/nlp/modeling/layers/tn_expand_condense.py
official/nlp/modeling/layers/tn_expand_condense.py
+2
-2
official/nlp/modeling/layers/tn_expand_condense_test.py
official/nlp/modeling/layers/tn_expand_condense_test.py
+2
-2
official/nlp/modeling/layers/tn_transformer_expand_condense.py
...ial/nlp/modeling/layers/tn_transformer_expand_condense.py
+2
-2
official/nlp/modeling/layers/tn_transformer_test.py
official/nlp/modeling/layers/tn_transformer_test.py
+2
-2
No files found.
official/nlp/modeling/layers/mobile_bert_layers.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""MobileBERT embedding and transformer layers."""
"""MobileBERT embedding and transformer layers."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
@@ -113,7 +113,6 @@ class MobileBertEmbedding(tf.keras.layers.Layer):
...
@@ -113,7 +113,6 @@ class MobileBertEmbedding(tf.keras.layers.Layer):
self
.
type_embedding
=
keras_nlp
.
layers
.
OnDeviceEmbedding
(
self
.
type_embedding
=
keras_nlp
.
layers
.
OnDeviceEmbedding
(
self
.
type_vocab_size
,
self
.
type_vocab_size
,
self
.
output_embed_size
,
self
.
output_embed_size
,
use_one_hot
=
True
,
initializer
=
initializer
,
initializer
=
initializer
,
name
=
'type_embedding'
)
name
=
'type_embedding'
)
self
.
pos_embedding
=
keras_nlp
.
layers
.
PositionEmbedding
(
self
.
pos_embedding
=
keras_nlp
.
layers
.
PositionEmbedding
(
...
...
official/nlp/modeling/layers/mobile_bert_layers_test.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
import
numpy
as
np
import
numpy
as
np
...
@@ -22,7 +22,7 @@ from official.nlp.modeling.networks import mobile_bert_encoder
...
@@ -22,7 +22,7 @@ from official.nlp.modeling.networks import mobile_bert_encoder
def
generate_fake_input
(
batch_size
=
1
,
seq_len
=
5
,
vocab_size
=
10000
,
seed
=
0
):
def
generate_fake_input
(
batch_size
=
1
,
seq_len
=
5
,
vocab_size
=
10000
,
seed
=
0
):
"""Generate consis
ita
nt fake integer input sequences."""
"""Generate consis
te
nt fake integer input sequences."""
np
.
random
.
seed
(
seed
)
np
.
random
.
seed
(
seed
)
fake_input
=
[]
fake_input
=
[]
for
_
in
range
(
batch_size
):
for
_
in
range
(
batch_size
):
...
...
official/nlp/modeling/layers/multi_channel_attention.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Multi-channel Attention."""
"""Multi-channel Attention."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
...
...
official/nlp/modeling/layers/multi_channel_attention_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for nlp.nhnet.multi_channel_attention."""
"""Tests for nlp.nhnet.multi_channel_attention."""
import
numpy
as
np
import
numpy
as
np
...
...
official/nlp/modeling/layers/on_device_embedding.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras-based one-hot embedding layer."""
"""Keras-based one-hot embedding layer."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
...
...
official/nlp/modeling/layers/position_embedding.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras-based positional embedding layer."""
"""Keras-based positional embedding layer."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
import
math
import
math
...
...
official/nlp/modeling/layers/position_embedding_test.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for Keras-based positional embedding layer."""
"""Tests for Keras-based positional embedding layer."""
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
...
...
official/nlp/modeling/layers/relative_attention.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras-based relative attention layers."""
"""Keras-based relative attention layers."""
import
math
import
math
import
string
import
string
...
...
official/nlp/modeling/layers/relative_attention_test.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for the attention layer."""
"""Tests for the attention layer."""
import
numpy
as
np
import
numpy
as
np
...
...
official/nlp/modeling/layers/rezero_transformer.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras-based rezero-transformer block layer (Transformer with ReZero)."""
"""Keras-based rezero-transformer block layer (Transformer with ReZero)."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
...
...
official/nlp/modeling/layers/rezero_transformer_test.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for Keras-based rezero-transformer block layer."""
"""Tests for Keras-based rezero-transformer block layer."""
import
numpy
as
np
import
numpy
as
np
...
...
official/nlp/modeling/layers/self_attention_mask.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras layer that creates a self-attention mask."""
"""Keras layer that creates a self-attention mask."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/modeling/layers/talking_heads_attention.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Talking Head Attention layer."""
"""Talking Head Attention layer."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
import
math
import
math
...
...
official/nlp/modeling/layers/talking_heads_attention_test.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for the attention layer."""
"""Tests for the attention layer."""
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
...
...
official/nlp/modeling/layers/text_layers.py
View file @
bb124157
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras Layers for BERT-specific preprocessing."""
"""Keras Layers for BERT-specific preprocessing."""
from
typing
import
Any
,
Dict
,
List
,
Optional
,
Union
from
typing
import
Any
,
Dict
,
List
,
Optional
,
Union
...
@@ -330,8 +330,7 @@ class SentencepieceTokenizer(tf.keras.layers.Layer):
...
@@ -330,8 +330,7 @@ class SentencepieceTokenizer(tf.keras.layers.Layer):
if
bool
(
model_file_path
)
==
bool
(
model_serialized_proto
):
if
bool
(
model_file_path
)
==
bool
(
model_serialized_proto
):
raise
ValueError
(
"Exact one of `model_file_path` and "
raise
ValueError
(
"Exact one of `model_file_path` and "
"`model_serialized_proto` can be specified."
)
"`model_serialized_proto` can be specified."
)
# TODO(chendouble): After b/149576200 is resolved, support
# TODO(b/181866850): Support tokenize_with_offsets for strip_diacritics=True
# tokenize_with_offsets when strip_diacritics is True,
if
tokenize_with_offsets
and
strip_diacritics
:
if
tokenize_with_offsets
and
strip_diacritics
:
raise
ValueError
(
"`tokenize_with_offsets` is not supported when "
raise
ValueError
(
"`tokenize_with_offsets` is not supported when "
"`strip_diacritics` is set to True."
)
"`strip_diacritics` is set to True."
)
...
@@ -378,8 +377,8 @@ class SentencepieceTokenizer(tf.keras.layers.Layer):
...
@@ -378,8 +377,8 @@ class SentencepieceTokenizer(tf.keras.layers.Layer):
"""
"""
if
self
.
_strip_diacritics
:
if
self
.
_strip_diacritics
:
if
self
.
tokenize_with_offsets
:
if
self
.
tokenize_with_offsets
:
raise
ValueError
(
"`tokenize_with_offsets` is not supported yet
due to
"
raise
ValueError
(
"`tokenize_with_offsets` is not supported yet
when
"
"
b/149576200, when
`strip_diacritics` is set to True."
)
"`strip_diacritics` is set to True
(b/181866850)
."
)
inputs
=
text
.
normalize_utf8
(
inputs
,
"NFD"
)
inputs
=
text
.
normalize_utf8
(
inputs
,
"NFD"
)
inputs
=
tf
.
strings
.
regex_replace
(
inputs
,
r
"\p{Mn}"
,
""
)
inputs
=
tf
.
strings
.
regex_replace
(
inputs
,
r
"\p{Mn}"
,
""
)
...
...
official/nlp/modeling/layers/text_layers_test.py
View file @
bb124157
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests bert.text_layers."""
"""Tests bert.text_layers."""
import
os
import
os
...
@@ -77,7 +77,7 @@ class RoundRobinTruncatorTest(tf.test.TestCase):
...
@@ -77,7 +77,7 @@ class RoundRobinTruncatorTest(tf.test.TestCase):
# This test covers the in-process behavior of a BertTokenizer layer.
# This test covers the in-process behavior of a BertTokenizer layer.
# For saving, restoring, and the restored behavior (incl. shape inference),
# For saving, restoring, and the restored behavior (incl. shape inference),
# see export_tf
u
b_test.py.
# see
nlp/tools/
export_tf
hub_li
b_test.py.
class
BertTokenizerTest
(
tf
.
test
.
TestCase
):
class
BertTokenizerTest
(
tf
.
test
.
TestCase
):
def
_make_vocab_file
(
self
,
vocab
,
filename
=
"vocab.txt"
):
def
_make_vocab_file
(
self
,
vocab
,
filename
=
"vocab.txt"
):
...
...
official/nlp/modeling/layers/tn_expand_condense.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""ExpandCondense tensor network layer used in TN-BERT."""
"""ExpandCondense tensor network layer used in TN-BERT."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
from
typing
import
List
,
Optional
,
Text
,
Any
,
Dict
from
typing
import
List
,
Optional
,
Text
,
Any
,
Dict
...
...
official/nlp/modeling/layers/tn_expand_condense_test.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for ExpandCondense tensor network layer."""
"""Tests for ExpandCondense tensor network layer."""
import
os
import
os
...
...
official/nlp/modeling/layers/tn_transformer_expand_condense.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""TN-BERT TNTransformerExpandCondense employing Expand-Condense layer instead of Dense."""
"""TN-BERT TNTransformerExpandCondense employing Expand-Condense layer instead of Dense."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
# Import libraries
# Import libraries
...
...
official/nlp/modeling/layers/tn_transformer_test.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for TN-BERT transformer."""
"""Tests for TN-BERT transformer."""
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
...
...
Prev
1
…
3
4
5
6
7
8
9
10
11
…
20
Next
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