Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KerasROOTClassification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nikolai.Hartmann
KerasROOTClassification
Commits
45f0ff96
Commit
45f0ff96
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Patches
Plain Diff
skip InputLayer and MaskingLayer in read_activations
parent
c4c88456
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_visualize_activations/read_activations.py
+7
-1
7 additions, 1 deletion
keras_visualize_activations/read_activations.py
with
7 additions
and
1 deletion
keras_visualize_activations/read_activations.py
+
7
−
1
View file @
45f0ff96
import
keras.backend
as
K
import
keras.backend
as
K
from
keras.engine.input_layer
import
InputLayer
from
keras.layers.core
import
Masking
def
get_activations
(
model
,
model_inputs
,
print_shape_only
=
False
,
layer_name
=
None
):
def
get_activations
(
model
,
model_inputs
,
print_shape_only
=
False
,
layer_name
=
None
):
print
(
'
----- activations -----
'
)
print
(
'
----- activations -----
'
)
...
@@ -12,8 +14,12 @@ def get_activations(model, model_inputs, print_shape_only=False, layer_name=None
...
@@ -12,8 +14,12 @@ def get_activations(model, model_inputs, print_shape_only=False, layer_name=None
inp
=
[
inp
]
inp
=
[
inp
]
model_multi_inputs_cond
=
False
model_multi_inputs_cond
=
False
# all layer outputs
# skip input and masking layers
outputs
=
[
layer
.
output
for
layer
in
model
.
layers
if
outputs
=
[
layer
.
output
for
layer
in
model
.
layers
if
layer
.
name
==
layer_name
or
layer_name
is
None
]
# all layer outputs
(
layer
.
name
==
layer_name
or
layer_name
is
None
)
and
not
isinstance
(
layer
,
InputLayer
)
and
not
isinstance
(
layer
,
Masking
)]
funcs
=
[
K
.
function
(
inp
+
[
K
.
learning_phase
()],
[
out
])
for
out
in
outputs
]
# evaluation functions
funcs
=
[
K
.
function
(
inp
+
[
K
.
learning_phase
()],
[
out
])
for
out
in
outputs
]
# evaluation functions
...
...
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