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
01f076ee
Commit
01f076ee
authored
7 years ago
by
Olivier Canévet
Browse files
Options
Downloads
Patches
Plain Diff
[test_lstm] Use slim fully connected
parent
7d70c020
Branches
Branches containing commit
Tags
v2.1.2
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/test/test_lstm.py
+7
-3
7 additions, 3 deletions
bob/learn/tensorflow/test/test_lstm.py
with
7 additions
and
3 deletions
bob/learn/tensorflow/test/test_lstm.py
+
7
−
3
View file @
01f076ee
...
@@ -76,14 +76,18 @@ def test_dnn_trainer():
...
@@ -76,14 +76,18 @@ def test_dnn_trainer():
graph
=
architecture
(
input_pl
)
graph
=
architecture
(
input_pl
)
elif
version
==
"
lstm
"
:
elif
version
==
"
lstm
"
:
W
=
tf
.
Variable
(
tf
.
random_normal
([
n_hidden
,
n_classes
]))
slim
=
tf
.
contrib
.
slim
b
=
tf
.
Variable
(
tf
.
random_normal
([
n_classes
]))
# W = tf.Variable(tf.random_normal([n_hidden, n_classes]))
# b = tf.Variable(tf.random_normal([n_classes]))
graph
=
input_pl
[:,
n_input
:]
graph
=
input_pl
[:,
n_input
:]
graph
=
tf
.
reshape
(
graph
,
(
-
1
,
n_steps
,
n_input
))
graph
=
tf
.
reshape
(
graph
,
(
-
1
,
n_steps
,
n_input
))
graph
=
tf
.
unstack
(
graph
,
n_steps
,
1
)
graph
=
tf
.
unstack
(
graph
,
n_steps
,
1
)
lstm_cell
=
tf
.
nn
.
rnn_cell
.
BasicLSTMCell
(
n_hidden
,
forget_bias
=
1.0
)
lstm_cell
=
tf
.
nn
.
rnn_cell
.
BasicLSTMCell
(
n_hidden
,
forget_bias
=
1.0
)
outputs
,
states
=
tf
.
nn
.
static_rnn
(
lstm_cell
,
graph
,
dtype
=
tf
.
float32
)
outputs
,
states
=
tf
.
nn
.
static_rnn
(
lstm_cell
,
graph
,
dtype
=
tf
.
float32
)
graph
=
tf
.
matmul
(
outputs
[
-
1
],
W
)
+
b
# graph = tf.matmul(outputs[-1], W) + b
graph
=
outputs
[
-
1
]
graph
=
slim
.
fully_connected
(
graph
,
n_classes
,
activation_fn
=
None
)
# Loss for the softmax
# Loss for the softmax
loss
=
BaseLoss
(
tf
.
nn
.
sparse_softmax_cross_entropy_with_logits
,
tf
.
reduce_mean
)
loss
=
BaseLoss
(
tf
.
nn
.
sparse_softmax_cross_entropy_with_logits
,
tf
.
reduce_mean
)
...
...
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