Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.tensorflow
Commits
202ac4ab
Commit
202ac4ab
authored
8 years ago
by
Pavel KORSHUNOV
Browse files
Options
Downloads
Patches
Plain Diff
make sure can work with hdf5 models
parent
287b1b73
No related branches found
No related tags found
1 merge request
!6
Merge branch with audio-stuff into master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/network/SequenceNetwork.py
+6
-5
6 additions, 5 deletions
bob/learn/tensorflow/network/SequenceNetwork.py
with
6 additions
and
5 deletions
bob/learn/tensorflow/network/SequenceNetwork.py
+
6
−
5
View file @
202ac4ab
...
...
@@ -120,11 +120,11 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
# Feeding the placeholder
if
self
.
inference_placeholder
is
None
:
self
.
compute_inference_placeholder
(
data
.
shape
[
1
:])
self
.
compute_inference_placeholder
(
[
None
]
+
list
(
data
.
shape
[
1
:])
)
feed_dict
=
{
self
.
inference_placeholder
:
data
}
if
self
.
inference_graph
is
None
:
self
.
compute_inference_graph
(
self
.
inference_placeholder
,
feature_layer
)
self
.
compute_inference_graph
(
feature_layer
)
embedding
=
session
.
run
([
self
.
inference_graph
],
feed_dict
=
feed_dict
)[
0
]
...
...
@@ -266,7 +266,8 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
hdf5
.
cd
(
'
/tensor_flow
'
)
for
k
in
self
.
sequence_net
:
# TODO: IT IS NOT SMART TESTING ALONG THIS PAGE
if
not
isinstance
(
self
.
sequence_net
[
k
],
MaxPooling
):
if
not
isinstance
(
self
.
sequence_net
[
k
],
MaxPooling
)
and
\
not
isinstance
(
self
.
sequence_net
[
k
],
LogSoftMax
):
self
.
sequence_net
[
k
].
W
.
assign
(
hdf5
.
read
(
self
.
sequence_net
[
k
].
W
.
name
)).
eval
(
session
=
session
)
session
.
run
(
self
.
sequence_net
[
k
].
W
)
self
.
sequence_net
[
k
].
b
.
assign
(
hdf5
.
read
(
self
.
sequence_net
[
k
].
b
.
name
)).
eval
(
session
=
session
)
...
...
@@ -300,11 +301,11 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
# Loading architecture
self
.
sequence_net
=
pickle
.
loads
(
hdf5
.
read
(
'
architecture
'
))
self
.
deployment_shape
=
hdf5
.
read
(
'
deployment_shape
'
)
self
.
turn_gpu_onoff
(
use_gpu
)
if
shape
is
None
:
self
.
deployment_shape
=
hdf5
.
read
(
'
deployment_shape
'
)
shape
=
self
.
deployment_shape
shape
[
0
]
=
batch
...
...
@@ -312,7 +313,7 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
place_holder
=
tf
.
placeholder
(
tf
.
float32
,
shape
=
shape
,
name
=
"
load
"
)
self
.
compute_graph
(
place_holder
)
tf
.
initialize_all_variables
().
run
(
session
=
session
)
self
.
load_variables_only
(
hdf5
,
session
)
self
.
load_variables_only
(
hdf5
)
def
save
(
self
,
saver
,
path
):
...
...
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