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
c5cfc25f
Commit
c5cfc25f
authored
Jan 21, 2016
by
Lukasz Kaiser
Browse files
Improve Neural GPU.
parent
d0d99252
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
neural_gpu/neural_gpu.py
neural_gpu/neural_gpu.py
+3
-2
neural_gpu/neural_gpu_trainer.py
neural_gpu/neural_gpu_trainer.py
+3
-2
No files found.
neural_gpu/neural_gpu.py
View file @
c5cfc25f
...
...
@@ -79,7 +79,7 @@ def make_dense(targets, noclass):
shape
=
tf
.
shape
(
targets
)
batch_size
=
shape
[
0
]
indices
=
targets
+
noclass
*
tf
.
range
(
0
,
batch_size
)
length
=
batch_size
*
noclass
length
=
tf
.
expand_dims
(
batch_size
*
noclass
,
0
)
dense
=
tf
.
sparse_to_dense
(
indices
,
length
,
1.0
,
0.0
)
return
tf
.
reshape
(
dense
,
[
-
1
,
noclass
])
...
...
@@ -91,7 +91,8 @@ def check_for_zero(sparse):
batch_size
=
shape
[
0
]
sparse
=
tf
.
minimum
(
sparse
,
1
)
indices
=
sparse
+
2
*
tf
.
range
(
0
,
batch_size
)
dense
=
tf
.
sparse_to_dense
(
indices
,
2
*
batch_size
,
1.0
,
0.0
)
dense
=
tf
.
sparse_to_dense
(
indices
,
tf
.
expand_dims
(
2
*
batch_size
,
0
),
1.0
,
0.0
)
reshaped
=
tf
.
reshape
(
dense
,
[
-
1
,
2
])
return
tf
.
reshape
(
tf
.
slice
(
reshaped
,
[
0
,
0
],
[
-
1
,
1
]),
[
-
1
])
...
...
neural_gpu/neural_gpu_trainer.py
View file @
c5cfc25f
...
...
@@ -22,11 +22,12 @@ tf.app.flags.DEFINE_float("max_grad_norm", 0.05, "Clip gradients to this norm.")
tf
.
app
.
flags
.
DEFINE_float
(
"cutoff"
,
1.2
,
"Cutoff at the gates."
)
tf
.
app
.
flags
.
DEFINE_float
(
"pull"
,
0.0005
,
"Starting pull of the relaxations."
)
tf
.
app
.
flags
.
DEFINE_float
(
"pull_incr"
,
1.2
,
"Increase pull by that much."
)
tf
.
app
.
flags
.
DEFINE_float
(
"curriculum_bound"
,
0.06
,
"Move curriculum < this."
)
tf
.
app
.
flags
.
DEFINE_float
(
"dropout"
,
0.15
,
"Dropout that much."
)
tf
.
app
.
flags
.
DEFINE_float
(
"grad_noise_scale"
,
1.0
,
"Gradient noise scale."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"batch_size"
,
64
,
"Batch size."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"low_batch_size"
,
16
,
"Low batch size."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"steps_per_checkpoint"
,
1
00
,
"Steps per epoch."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"steps_per_checkpoint"
,
2
00
,
"Steps per epoch."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"nmaps"
,
24
,
"Number of floats in each cell."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"niclass"
,
14
,
"Number of classes (0 is padding)."
)
tf
.
app
.
flags
.
DEFINE_integer
(
"noclass"
,
14
,
"Number of classes (0 is padding)."
)
...
...
@@ -84,7 +85,7 @@ def initialize(sess):
data
.
init_data
(
t
,
data
.
forward_max
,
end_size
,
nclass
)
# Print out parameters.
curriculum
=
0.12
curriculum
=
FLAGS
.
curriculum_bound
msg1
=
(
"layers %d kw %d h %d kh %d relax %d batch %d noise %.2f task %s"
%
(
FLAGS
.
nconvs
,
FLAGS
.
kw
,
FLAGS
.
height
,
FLAGS
.
kh
,
FLAGS
.
rx_step
,
FLAGS
.
batch_size
,
FLAGS
.
grad_noise_scale
,
FLAGS
.
task
))
...
...
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