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
99f9442b
"vscode:/vscode.git/clone" did not exist on "6250b2cbf986e81d4c8cd31baf5e95f37481e39f"
Commit
99f9442b
authored
May 22, 2017
by
Neal Wu
Browse files
Remove barrier, add tf.identity where appropriate, and make sure tests pass
parent
8e54ffc8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
12 deletions
+6
-12
inception/inception/slim/ops_test.py
inception/inception/slim/ops_test.py
+4
-10
slim/deployment/model_deploy.py
slim/deployment/model_deploy.py
+1
-1
slim/train_image_classifier.py
slim/train_image_classifier.py
+1
-1
No files found.
inception/inception/slim/ops_test.py
View file @
99f9442b
...
@@ -418,7 +418,7 @@ class DropoutTest(tf.test.TestCase):
...
@@ -418,7 +418,7 @@ class DropoutTest(tf.test.TestCase):
with
self
.
test_session
():
with
self
.
test_session
():
images
=
tf
.
random_uniform
((
5
,
height
,
width
,
3
),
seed
=
1
)
images
=
tf
.
random_uniform
((
5
,
height
,
width
,
3
),
seed
=
1
)
output
=
ops
.
dropout
(
images
)
output
=
ops
.
dropout
(
images
)
self
.
assertEquals
(
output
.
op
.
name
,
'Dropout/dropout/mul
_1
'
)
self
.
assertEquals
(
output
.
op
.
name
,
'Dropout/dropout/mul'
)
output
.
get_shape
().
assert_is_compatible_with
(
images
.
get_shape
())
output
.
get_shape
().
assert_is_compatible_with
(
images
.
get_shape
())
def
testCreateDropoutNoTraining
(
self
):
def
testCreateDropoutNoTraining
(
self
):
...
@@ -599,8 +599,6 @@ class BatchNormTest(tf.test.TestCase):
...
@@ -599,8 +599,6 @@ class BatchNormTest(tf.test.TestCase):
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
)
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
with
tf
.
control_dependencies
(
update_ops
):
with
tf
.
control_dependencies
(
update_ops
):
barrier
=
tf
.
no_op
(
name
=
'gradient_barrier'
)
with
tf
.
control_dependencies
([
barrier
]):
output
=
tf
.
identity
(
output
)
output
=
tf
.
identity
(
output
)
# Initialize all variables
# Initialize all variables
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
global_variables_initializer
())
...
@@ -630,8 +628,6 @@ class BatchNormTest(tf.test.TestCase):
...
@@ -630,8 +628,6 @@ class BatchNormTest(tf.test.TestCase):
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
,
is_training
=
False
)
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
,
is_training
=
False
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
with
tf
.
control_dependencies
(
update_ops
):
with
tf
.
control_dependencies
(
update_ops
):
barrier
=
tf
.
no_op
(
name
=
'gradient_barrier'
)
with
tf
.
control_dependencies
([
barrier
]):
output
=
tf
.
identity
(
output
)
output
=
tf
.
identity
(
output
)
# Initialize all variables
# Initialize all variables
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
global_variables_initializer
())
...
@@ -665,8 +661,6 @@ class BatchNormTest(tf.test.TestCase):
...
@@ -665,8 +661,6 @@ class BatchNormTest(tf.test.TestCase):
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
,
is_training
=
False
)
output
=
ops
.
batch_norm
(
images
,
decay
=
0.1
,
is_training
=
False
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
update_ops
=
tf
.
get_collection
(
ops
.
UPDATE_OPS_COLLECTION
)
with
tf
.
control_dependencies
(
update_ops
):
with
tf
.
control_dependencies
(
update_ops
):
barrier
=
tf
.
no_op
(
name
=
'gradient_barrier'
)
with
tf
.
control_dependencies
([
barrier
]):
output
=
tf
.
identity
(
output
)
output
=
tf
.
identity
(
output
)
# Initialize all variables
# Initialize all variables
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
global_variables_initializer
())
...
...
slim/deployment/model_deploy.py
View file @
99f9442b
...
@@ -379,7 +379,7 @@ def deploy(config,
...
@@ -379,7 +379,7 @@ def deploy(config,
update_op
=
tf
.
group
(
*
update_ops
)
update_op
=
tf
.
group
(
*
update_ops
)
with
tf
.
control_dependencies
([
update_op
]):
with
tf
.
control_dependencies
([
update_op
]):
train_op
=
t
otal_loss
train_op
=
t
f
.
identity
(
total_loss
,
name
=
'train_op'
)
else
:
else
:
clones_losses
=
[]
clones_losses
=
[]
regularization_losses
=
tf
.
get_collection
(
regularization_losses
=
tf
.
get_collection
(
...
...
slim/train_image_classifier.py
View file @
99f9442b
...
@@ -540,7 +540,7 @@ def main(_):
...
@@ -540,7 +540,7 @@ def main(_):
update_op
=
tf
.
group
(
*
update_ops
)
update_op
=
tf
.
group
(
*
update_ops
)
with
tf
.
control_dependencies
([
update_op
]):
with
tf
.
control_dependencies
([
update_op
]):
train_tensor
=
t
otal_loss
train_tensor
=
t
f
.
identity
(
total_loss
,
name
=
'train_op'
)
# Add the summaries from the first clone. These contain the summaries
# Add the summaries from the first clone. These contain the summaries
# created by model_fn and either optimize_clones() or _gather_clone_loss().
# created by model_fn and either optimize_clones() or _gather_clone_loss().
...
...
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