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
611abda1
Commit
611abda1
authored
Mar 27, 2022
by
exx8
Browse files
add a get_config implementation.
parent
50369291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
official/projects/vit/modeling/vit.py
official/projects/vit/modeling/vit.py
+16
-0
No files found.
official/projects/vit/modeling/vit.py
View file @
611abda1
...
...
@@ -172,6 +172,22 @@ class Encoder(tf.keras.layers.Layer):
x
=
encoder_layer
(
x
,
training
=
training
)
x
=
self
.
_norm
(
x
)
return
x
def
get_config
(
self
):
config
=
{
'num_layers'
:
self
.
_num_layers
,
'mlp_dim'
:
self
.
_mlp_dim
,
'num_heads'
:
self
.
_num_heads
,
'dropout_rate'
:
self
.
_dropout_rate
,
'attention_dropout_rate'
:
self
.
_attention_dropout_rate
,
'kernel_regularizer'
:
self
.
_kernel_regularizer
,
'inputs_positions'
:
self
.
_inputs_positions
,
'init_stochastic_depth_rate'
:
self
.
_init_stochastic_depth_rate
,
'kernel_initializer'
:
self
.
_kernel_initializer
,
'add_pos_embed'
:
self
.
_add_pos_embed
,
}
base_config
=
super
().
get_config
()
return
dict
(
list
(
base_config
.
items
())
+
list
(
config
.
items
()))
class
VisionTransformer
(
tf
.
keras
.
Model
):
...
...
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