Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
3efce3ae
Commit
3efce3ae
authored
Apr 22, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tower-summary bug
parent
d5fe531d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
9 deletions
+11
-9
examples/cifar10-convnet.py
examples/cifar10-convnet.py
+0
-2
tensorpack/dataflow/dataset/visualqa.py
tensorpack/dataflow/dataset/visualqa.py
+8
-3
tensorpack/tfutils/sessinit.py
tensorpack/tfutils/sessinit.py
+0
-1
tensorpack/tfutils/summary.py
tensorpack/tfutils/summary.py
+1
-1
tensorpack/train/trainer.py
tensorpack/train/trainer.py
+2
-2
No files found.
examples/cifar10-convnet.py
View file @
3efce3ae
...
...
@@ -100,8 +100,6 @@ def get_data(train_or_test):
ds
=
PrefetchData
(
ds
,
10
,
5
)
return
ds
def
get_config
():
# prepare dataset
dataset_train
=
get_data
(
'train'
)
...
...
tensorpack/dataflow/dataset/visualqa.py
View file @
3efce3ae
...
...
@@ -11,6 +11,12 @@ import json
__all__
=
[
'VisualQA'
]
def
read_json
(
fname
):
f
=
open
(
fname
)
ret
=
json
.
load
(
f
)
f
.
close
()
return
ret
# TODO shuffle
class
VisualQA
(
DataFlow
):
"""
...
...
@@ -19,12 +25,11 @@ class VisualQA(DataFlow):
"""
def
__init__
(
self
,
question_file
,
annotation_file
):
with
timed_operation
(
'Reading VQA JSON file'
):
qobj
=
json
.
load
(
open
(
question_file
))
qobj
,
aobj
=
list
(
map
(
read_json
,
[
question_file
,
annotation_file
]
))
self
.
task_type
=
qobj
[
'task_type'
]
self
.
questions
=
qobj
[
'questions'
]
self
.
_size
=
len
(
self
.
questions
)
aobj
=
json
.
load
(
open
(
annotation_file
))
self
.
anno
=
aobj
[
'annotations'
]
assert
len
(
self
.
anno
)
==
len
(
self
.
questions
),
\
"{}!={}"
.
format
(
len
(
self
.
anno
),
len
(
self
.
questions
))
...
...
@@ -49,7 +54,7 @@ class VisualQA(DataFlow):
"""
cnt
=
Counter
()
for
anno
in
self
.
anno
:
cnt
[
anno
[
'multiple_choice_answer'
]]
+=
1
cnt
[
anno
[
'multiple_choice_answer'
]
.
lower
()
]
+=
1
return
[
k
[
0
]
for
k
in
cnt
.
most_common
(
n
)]
def
get_common_question_words
(
self
,
n
):
...
...
tensorpack/tfutils/sessinit.py
View file @
3efce3ae
...
...
@@ -107,7 +107,6 @@ class SaverRestore(SessionInit):
logger
.
warn
(
"Param {} not found in checkpoint! Will not restore."
.
format
(
v
.
op
.
name
))
return
var_dict
class
ParamRestore
(
SessionInit
):
"""
Restore trainable variables from a dictionary.
...
...
tensorpack/tfutils/summary.py
View file @
3efce3ae
...
...
@@ -69,7 +69,7 @@ def add_param_summary(summary_lists):
for
act
in
actions
:
perform
(
p
,
act
)
# TODO
use name of cost_var
# TODO
get rid of the cost_var thing...
def
summary_moving_average
(
cost_var
):
""" Create a MovingAverage op and summary for all variables in
MOVING_SUMMARY_VARS_KEY, as well as `cost_var`.
...
...
tensorpack/train/trainer.py
View file @
3efce3ae
...
...
@@ -137,8 +137,8 @@ class QueueInputTrainer(Trainer):
kept_summaries
[
k
]
=
copy
.
copy
(
tf
.
get_collection
(
k
))
logger
.
info
(
"Graph built for tower {}."
.
format
(
i
))
for
k
in
coll_keys
:
del
tf
.
get_collection
(
k
)[:]
tf
.
get_collection
(
k
)
.
extend
(
kept_summaries
[
k
])
del
tf
.
get_collection
_ref
(
k
)[:]
tf
.
get_collection
_ref
(
k
)
.
extend
(
kept_summaries
[
k
])
grads
=
QueueInputTrainer
.
_average_grads
(
grad_list
)
cost_var
=
cost_var_t0
else
:
...
...
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