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
e89a5613
Commit
e89a5613
authored
Jun 17, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
acc.count
parent
13f62fdc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
tensorpack/predict/dataset.py
tensorpack/predict/dataset.py
+1
-1
tensorpack/utils/discretize.py
tensorpack/utils/discretize.py
+8
-1
tensorpack/utils/stat.py
tensorpack/utils/stat.py
+4
-0
tensorpack/utils/utils.py
tensorpack/utils/utils.py
+1
-1
No files found.
tensorpack/predict/dataset.py
View file @
e89a5613
...
@@ -66,7 +66,7 @@ class MultiProcessDatasetPredictor(DatasetPredictorBase):
...
@@ -66,7 +66,7 @@ class MultiProcessDatasetPredictor(DatasetPredictorBase):
Run prediction in multiprocesses, on either CPU or GPU. Mix mode not supported.
Run prediction in multiprocesses, on either CPU or GPU. Mix mode not supported.
:param nr_proc: number of processes to use
:param nr_proc: number of processes to use
:param use_gpu: use GPU or CPU.
:param use_gpu: use GPU or CPU.
nr_proc cannot be larger than the total number of GPUs available
if GPU, then
nr_proc cannot be larger than the total number of GPUs available
in CUDA_VISIBLE_DEVICES or in the system.
in CUDA_VISIBLE_DEVICES or in the system.
"""
"""
assert
config
.
return_input
==
False
,
"return_input not supported for MultiProcessDatasetPredictor"
assert
config
.
return_input
==
False
,
"return_input not supported for MultiProcessDatasetPredictor"
...
...
tensorpack/utils/discretize.py
View file @
e89a5613
...
@@ -31,10 +31,15 @@ class Discretizer1D(Discretizer):
...
@@ -31,10 +31,15 @@ class Discretizer1D(Discretizer):
class
UniformDiscretizer1D
(
Discretizer1D
):
class
UniformDiscretizer1D
(
Discretizer1D
):
def
__init__
(
self
,
minv
,
maxv
,
spacing
):
def
__init__
(
self
,
minv
,
maxv
,
spacing
):
"""
:params minv: minimum value of the first bin
:params maxv: maximum value of the last bin
:param spacing: width of a bin
"""
self
.
minv
=
float
(
minv
)
self
.
minv
=
float
(
minv
)
self
.
maxv
=
float
(
maxv
)
self
.
maxv
=
float
(
maxv
)
self
.
spacing
=
float
(
spacing
)
self
.
spacing
=
float
(
spacing
)
self
.
nr_bin
=
np
.
ceil
((
self
.
maxv
-
self
.
minv
)
/
self
.
spacing
)
self
.
nr_bin
=
int
(
np
.
ceil
((
self
.
maxv
-
self
.
minv
)
/
self
.
spacing
)
)
def
get_nr_bin
(
self
):
def
get_nr_bin
(
self
):
return
self
.
nr_bin
return
self
.
nr_bin
...
@@ -51,6 +56,8 @@ class UniformDiscretizer1D(Discretizer1D):
...
@@ -51,6 +56,8 @@ class UniformDiscretizer1D(Discretizer1D):
0
,
self
.
nr_bin
-
1
))
0
,
self
.
nr_bin
-
1
))
def
get_distribution
(
self
,
v
,
smooth_factor
=
0.05
,
smooth_radius
=
2
):
def
get_distribution
(
self
,
v
,
smooth_factor
=
0.05
,
smooth_radius
=
2
):
""" return a smoothed one-hot distribution of the sample v.
"""
b
=
self
.
get_bin
(
v
)
b
=
self
.
get_bin
(
v
)
ret
=
np
.
zeros
((
self
.
nr_bin
,
),
dtype
=
'float32'
)
ret
=
np
.
zeros
((
self
.
nr_bin
,
),
dtype
=
'float32'
)
ret
[
b
]
=
1.0
ret
[
b
]
=
1.0
...
...
tensorpack/utils/stat.py
View file @
e89a5613
...
@@ -52,6 +52,10 @@ class Accuracy(object):
...
@@ -52,6 +52,10 @@ class Accuracy(object):
return
0
return
0
return
self
.
corr
*
1.0
/
self
.
tot
return
self
.
corr
*
1.0
/
self
.
tot
@
property
def
count
(
self
):
return
self
.
tot
class
BinaryStatistics
(
object
):
class
BinaryStatistics
(
object
):
"""
"""
...
...
tensorpack/utils/utils.py
View file @
e89a5613
...
@@ -92,6 +92,6 @@ def get_dataset_dir(name):
...
@@ -92,6 +92,6 @@ def get_dataset_dir(name):
assert
os
.
path
.
isdir
(
d
)
assert
os
.
path
.
isdir
(
d
)
else
:
else
:
d
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'dataflow'
,
'dataset'
)
d
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'dataflow'
,
'dataset'
)
logger
.
info
(
"TENSORPACK_DATASET not set, using {}
to keep
dataset."
.
format
(
d
))
logger
.
info
(
"TENSORPACK_DATASET not set, using {}
for
dataset."
.
format
(
d
))
return
os
.
path
.
join
(
d
,
name
)
return
os
.
path
.
join
(
d
,
name
)
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