Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
3pia
CMS Analyses
Tools
Commits
711b0e59
Commit
711b0e59
authored
4 years ago
by
Dennis Noll
Browse files
Options
Downloads
Patches
Plain Diff
[keras] Layers: fixed saving
parent
3b6be777
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
keras.py
+11
-11
11 additions, 11 deletions
keras.py
with
11 additions
and
11 deletions
keras.py
+
11
−
11
View file @
711b0e59
...
...
@@ -899,7 +899,7 @@ class DenseLayer(tf.keras.layers.Layer):
"""
def
__init__
(
self
,
nodes
=
0
,
activation
=
None
,
dropout
=
0.0
,
l2
=
0
,
batch_norm
=
False
):
super
().
__init__
()
super
().
__init__
(
name
=
"
DenseLayer
"
)
self
.
nodes
=
nodes
self
.
activation
=
activation
self
.
dropout
=
dropout
...
...
@@ -914,7 +914,7 @@ class DenseLayer(tf.keras.layers.Layer):
parts
.
append
(
weights
)
if
self
.
batch_norm
:
dropout
=
0.0
self
.
dropout
=
0.0
bn
=
tf
.
keras
.
layers
.
BatchNormalization
()
parts
.
append
(
bn
)
...
...
@@ -922,9 +922,9 @@ class DenseLayer(tf.keras.layers.Layer):
parts
.
append
(
act
)
if
self
.
activation
==
"
selu
"
:
dropout
=
tf
.
keras
.
layers
.
AlphaDropout
(
dropout
)
dropout
=
tf
.
keras
.
layers
.
AlphaDropout
(
self
.
dropout
)
else
:
dropout
=
tf
.
keras
.
layers
.
Dropout
(
dropout
)
dropout
=
tf
.
keras
.
layers
.
Dropout
(
self
.
dropout
)
parts
.
append
(
dropout
)
self
.
parts
=
parts
...
...
@@ -995,25 +995,25 @@ class FullyConnected(tf.keras.layers.Layer):
"""
def
__init__
(
self
,
layers
=
0
,
**
kwargs
):
def
__init__
(
self
,
layers
=
0
,
sub_kwargs
=
None
,
**
kwargs
):
super
().
__init__
(
name
=
"
FullyConnected
"
)
self
.
layers
=
layers
self
.
kwargs
=
kwargs
self
.
sub_
kwargs
=
kwargs
if
sub_kwargs
is
None
else
sub_kwargs
def
build
(
self
,
input_shape
):
_layers
=
[]
network
_layers
=
[]
for
layer
in
range
(
self
.
layers
):
_layers
.
append
(
DenseLayer
(
**
self
.
kwargs
))
self
.
_layers
=
_layers
network
_layers
.
append
(
DenseLayer
(
**
self
.
sub_
kwargs
))
self
.
network
_layers
=
network
_layers
def
call
(
self
,
input_tensor
,
training
=
False
):
x
=
input_tensor
for
layer
in
self
.
_layers
:
for
layer
in
self
.
network
_layers
:
x
=
layer
(
x
,
training
=
training
)
return
x
def
get_config
(
self
):
return
{
"
layers
"
:
self
.
layers
}
return
{
"
layers
"
:
self
.
layers
,
"
sub_kwargs
"
:
self
.
sub_kwargs
}
class
ResNet
(
tf
.
keras
.
layers
.
Layer
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment