Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
re3-tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Show more breadcrumbs
Daniel Gordon
re3-tensorflow
Commits
2aef8f79
Commit
2aef8f79
authored
7 years ago
by
Daniel Gordon
Browse files
Options
Downloads
Patches
Plain Diff
added debug stuff to tf_queue
parent
ff525d68
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
re3_utils/tensorflow_util/tf_queue.py
+17
-0
17 additions, 0 deletions
re3_utils/tensorflow_util/tf_queue.py
with
17 additions
and
0 deletions
re3_utils/tensorflow_util/tf_queue.py
+
17
−
0
View file @
2aef8f79
...
...
@@ -3,6 +3,8 @@ import threading
import
numpy
as
np
import
time
DEBUG
=
True
class
TFQueue
(
object
):
def
__init__
(
self
,
sess
,
placeholders
,
max_queue_size
,
max_queue_uses
,
use_random_order
,
batch_size
):
...
...
@@ -16,6 +18,7 @@ class TFQueue(object):
self
.
batch_size
=
batch_size
self
.
enqueue_batch_size
=
self
.
placeholders
[
0
].
get_shape
().
as_list
()[
0
]
self
.
use_random_order
=
use_random_order
self
.
num_samples
=
0
# Set up queue and operations
with
tf
.
device
(
'
/cpu:0
'
):
...
...
@@ -69,6 +72,20 @@ class TFQueue(object):
feed_dict
[
placeholder
].
append
(
data
[
placeholder
])
feed_dict
=
{
key
:
np
.
ascontiguousarray
(
val
)
for
(
key
,
val
)
in
feed_dict
.
items
()}
self
.
num_samples
+=
1
if
DEBUG
and
self
.
num_samples
%
10
==
0
:
if
len
(
self
.
data_buffer
)
<
self
.
max_queue_size
:
print
(
'
Buffer size: %d Num unused: %d Max times used: %d Median times used: %d
\n
'
%
(
len
(
self
.
data_buffer
),
(
len
(
self
.
data_buffer
)
-
len
(
self
.
data_counts
[
self
.
data_counts
>
0
])),
np
.
max
(
self
.
data_counts
),
np
.
median
(
self
.
data_counts
)))
else
:
print
(
'
Buffer Full. Num unused: %d Max times used: %d Median times used: %d
\n
'
%
(
(
len
(
self
.
data_buffer
)
-
len
(
self
.
data_counts
[
self
.
data_counts
>
0
])),
np
.
max
(
self
.
data_counts
),
np
.
median
(
self
.
data_counts
)))
self
.
lock
.
release
()
return
feed_dict
...
...
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