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
1d4fc91a
There was a problem fetching the pipeline summary.
Commit
1d4fc91a
authored
7 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
Pass logits and labels to losses using kwargs
parent
90b4835f
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!49
Pass logits and labels to losses using kwargs
Pipeline
#
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/estimators/Logits.py
+9
-9
9 additions, 9 deletions
bob/learn/tensorflow/estimators/Logits.py
with
9 additions
and
9 deletions
bob/learn/tensorflow/estimators/Logits.py
+
9
−
9
View file @
1d4fc91a
...
...
@@ -80,12 +80,12 @@ class Logits(estimator.Estimator):
"
scopes
"
: dict({
"
<SOURCE_SCOPE>/
"
:
"
<TARGET_SCOPE>/
"
}),
"
trainable_variables
"
: [<LIST OF VARIABLES OR SCOPES THAT YOU WANT TO RETRAIN>]
}
apply_moving_averages: bool
Apply exponential moving average in the training variables and in the loss.
https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage
By default the decay for the variable averages is 0.9999 and for the loss is 0.9
"""
def
__init__
(
self
,
...
...
@@ -144,7 +144,7 @@ class Logits(estimator.Estimator):
with
tf
.
control_dependencies
([
variable_averages_op
]):
# Compute Loss (for both TRAIN and EVAL modes)
self
.
loss
=
self
.
loss_op
(
logits
,
labels
)
self
.
loss
=
self
.
loss_op
(
logits
=
logits
,
labels
=
labels
)
# Compute the moving average of all individual losses and the total loss.
loss_averages
=
tf
.
train
.
ExponentialMovingAverage
(
0.9
,
name
=
'
avg
'
)
...
...
@@ -187,7 +187,7 @@ class Logits(estimator.Estimator):
mode
=
mode
,
predictions
=
predictions
)
# IF Validation
self
.
loss
=
self
.
loss_op
(
logits
,
labels
)
self
.
loss
=
self
.
loss_op
(
logits
=
logits
,
labels
=
labels
)
if
self
.
embedding_validation
:
predictions_op
=
predict_using_tensors
(
...
...
@@ -266,7 +266,7 @@ class LogitsCenterLoss(estimator.Estimator):
params:
Extra params for the model function (please see
https://www.tensorflow.org/extend/estimators for more info)
extra_checkpoint: dict
In case you want to use other model to initialize some variables.
This argument should be in the following format
...
...
@@ -275,13 +275,13 @@ class LogitsCenterLoss(estimator.Estimator):
"
scopes
"
: dict({
"
<SOURCE_SCOPE>/
"
:
"
<TARGET_SCOPE>/
"
}),
"
trainable_variables
"
: [<LIST OF VARIABLES OR SCOPES THAT YOU WANT TO TRAIN>]
}
apply_moving_averages: bool
Apply exponential moving average in the training variables and in the loss.
https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage
By default the decay for the variable averages is 0.9999 and for the loss is 0.9
"""
...
...
@@ -365,7 +365,7 @@ class LogitsCenterLoss(estimator.Estimator):
# Compute the moving average of all individual losses and the total loss.
loss_averages
=
tf
.
train
.
ExponentialMovingAverage
(
0.9
,
name
=
'
avg
'
)
loss_averages_op
=
loss_averages
.
apply
(
tf
.
get_collection
(
tf
.
GraphKeys
.
LOSSES
))
for
l
in
tf
.
get_collection
(
tf
.
GraphKeys
.
LOSSES
):
tf
.
summary
.
scalar
(
l
.
op
.
name
,
loss_averages
.
average
(
l
))
...
...
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