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
d5e826e3
"test/vscode:/vscode.git/clone" did not exist on "6a01b87be9653b1105bbd363eed14a5d6af13e87"
Unverified
Commit
d5e826e3
authored
Jan 29, 2018
by
Steven Hickson
Committed by
GitHub
Jan 29, 2018
Browse files
Merge branch 'master' into master
parents
e1ac09e1
fc37f117
Changes
153
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
54 additions
and
37 deletions
+54
-37
research/differential_privacy/multiple_teachers/analysis.py
research/differential_privacy/multiple_teachers/analysis.py
+11
-10
research/differential_privacy/multiple_teachers/deep_cnn.py
research/differential_privacy/multiple_teachers/deep_cnn.py
+1
-2
research/differential_privacy/multiple_teachers/input.py
research/differential_privacy/multiple_teachers/input.py
+1
-0
research/differential_privacy/multiple_teachers/train_student.py
...h/differential_privacy/multiple_teachers/train_student.py
+1
-0
research/differential_privacy/privacy_accountant/python/gaussian_moments.py
...ial_privacy/privacy_accountant/python/gaussian_moments.py
+16
-13
research/domain_adaptation/domain_separation/dsn_eval.py
research/domain_adaptation/domain_separation/dsn_eval.py
+1
-0
research/gan/cifar/util.py
research/gan/cifar/util.py
+1
-0
research/gan/image_compression/networks_test.py
research/gan/image_compression/networks_test.py
+1
-0
research/gan/mnist/util.py
research/gan/mnist/util.py
+1
-0
research/gan/mnist_estimator/train.py
research/gan/mnist_estimator/train.py
+1
-0
research/im2txt/README.md
research/im2txt/README.md
+5
-5
research/im2txt/im2txt/data/build_mscoco_data.py
research/im2txt/im2txt/data/build_mscoco_data.py
+1
-0
research/im2txt/im2txt/evaluate.py
research/im2txt/im2txt/evaluate.py
+2
-2
research/im2txt/im2txt/run_inference.py
research/im2txt/im2txt/run_inference.py
+1
-1
research/learned_optimizer/metaopt.py
research/learned_optimizer/metaopt.py
+1
-0
research/learning_to_remember_rare_events/data_utils.py
research/learning_to_remember_rare_events/data_utils.py
+1
-0
research/learning_to_remember_rare_events/memory.py
research/learning_to_remember_rare_events/memory.py
+1
-0
research/learning_to_remember_rare_events/train.py
research/learning_to_remember_rare_events/train.py
+1
-0
research/lfads/synth_data/generate_itb_data.py
research/lfads/synth_data/generate_itb_data.py
+5
-4
research/lfads/synth_data/generate_labeled_rnn_data.py
research/lfads/synth_data/generate_labeled_rnn_data.py
+1
-0
No files found.
research/differential_privacy/multiple_teachers/analysis.py
View file @
d5e826e3
...
@@ -41,6 +41,7 @@ python analysis.py
...
@@ -41,6 +41,7 @@ python analysis.py
import
os
import
os
import
math
import
math
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
differential_privacy.multiple_teachers.input
import
maybe_download
from
differential_privacy.multiple_teachers.input
import
maybe_download
...
@@ -139,7 +140,7 @@ def logmgf_exact(q, priv_eps, l):
...
@@ -139,7 +140,7 @@ def logmgf_exact(q, priv_eps, l):
try
:
try
:
log_t
=
math
.
log
(
t
)
log_t
=
math
.
log
(
t
)
except
ValueError
:
except
ValueError
:
print
"Got ValueError in math.log for values :"
+
str
((
q
,
priv_eps
,
l
,
t
))
print
(
"Got ValueError in math.log for values :"
+
str
((
q
,
priv_eps
,
l
,
t
))
)
log_t
=
priv_eps
*
l
log_t
=
priv_eps
*
l
else
:
else
:
log_t
=
priv_eps
*
l
log_t
=
priv_eps
*
l
...
@@ -171,7 +172,7 @@ def sens_at_k(counts, noise_eps, l, k):
...
@@ -171,7 +172,7 @@ def sens_at_k(counts, noise_eps, l, k):
"""
"""
counts_sorted
=
sorted
(
counts
,
reverse
=
True
)
counts_sorted
=
sorted
(
counts
,
reverse
=
True
)
if
0.5
*
noise_eps
*
l
>
1
:
if
0.5
*
noise_eps
*
l
>
1
:
print
"l too large to compute sensitivity"
print
(
"l too large to compute sensitivity"
)
return
0
return
0
# Now we can assume that at k, gap remains positive
# Now we can assume that at k, gap remains positive
# or we have reached the point where logmgf_exact is
# or we have reached the point where logmgf_exact is
...
@@ -268,8 +269,8 @@ def main(unused_argv):
...
@@ -268,8 +269,8 @@ def main(unused_argv):
# Solving gives eps = (alpha - ln (delta))/l
# Solving gives eps = (alpha - ln (delta))/l
eps_list_nm
=
(
total_log_mgf_nm
-
math
.
log
(
delta
))
/
l_list
eps_list_nm
=
(
total_log_mgf_nm
-
math
.
log
(
delta
))
/
l_list
print
"Epsilons (Noisy Max): "
+
str
(
eps_list_nm
)
print
(
"Epsilons (Noisy Max): "
+
str
(
eps_list_nm
)
)
print
"Smoothed sensitivities (Noisy Max): "
+
str
(
total_ss_nm
/
l_list
)
print
(
"Smoothed sensitivities (Noisy Max): "
+
str
(
total_ss_nm
/
l_list
)
)
# If beta < eps / 2 ln (1/delta), then adding noise Lap(1) * 2 SS/eps
# If beta < eps / 2 ln (1/delta), then adding noise Lap(1) * 2 SS/eps
# is eps,delta DP
# is eps,delta DP
...
@@ -280,12 +281,12 @@ def main(unused_argv):
...
@@ -280,12 +281,12 @@ def main(unused_argv):
# Print the first one's scale
# Print the first one's scale
ss_eps
=
2.0
*
beta
*
math
.
log
(
1
/
delta
)
ss_eps
=
2.0
*
beta
*
math
.
log
(
1
/
delta
)
ss_scale
=
2.0
/
ss_eps
ss_scale
=
2.0
/
ss_eps
print
"To get an "
+
str
(
ss_eps
)
+
"-DP estimate of epsilon, "
print
(
"To get an "
+
str
(
ss_eps
)
+
"-DP estimate of epsilon, "
)
print
"..add noise ~ "
+
str
(
ss_scale
)
print
(
"..add noise ~ "
+
str
(
ss_scale
)
)
print
"... times "
+
str
(
total_ss_nm
/
l_list
)
print
(
"... times "
+
str
(
total_ss_nm
/
l_list
)
)
print
"Epsilon = "
+
str
(
min
(
eps_list_nm
))
+
"."
print
(
"Epsilon = "
+
str
(
min
(
eps_list_nm
))
+
"."
)
if
min
(
eps_list_nm
)
==
eps_list_nm
[
-
1
]:
if
min
(
eps_list_nm
)
==
eps_list_nm
[
-
1
]:
print
"Warning: May not have used enough values of l"
print
(
"Warning: May not have used enough values of l"
)
# Data independent bound, as mechanism is
# Data independent bound, as mechanism is
# 2*noise_eps DP.
# 2*noise_eps DP.
...
@@ -294,7 +295,7 @@ def main(unused_argv):
...
@@ -294,7 +295,7 @@ def main(unused_argv):
[
logmgf_exact
(
1.0
,
2.0
*
noise_eps
,
l
)
for
l
in
l_list
])
[
logmgf_exact
(
1.0
,
2.0
*
noise_eps
,
l
)
for
l
in
l_list
])
data_ind_eps_list
=
(
data_ind_log_mgf
-
math
.
log
(
delta
))
/
l_list
data_ind_eps_list
=
(
data_ind_log_mgf
-
math
.
log
(
delta
))
/
l_list
print
"Data independent bound = "
+
str
(
min
(
data_ind_eps_list
))
+
"."
print
(
"Data independent bound = "
+
str
(
min
(
data_ind_eps_list
))
+
"."
)
return
return
...
...
research/differential_privacy/multiple_teachers/deep_cnn.py
View file @
d5e826e3
...
@@ -20,6 +20,7 @@ from __future__ import print_function
...
@@ -20,6 +20,7 @@ from __future__ import print_function
from
datetime
import
datetime
from
datetime
import
datetime
import
math
import
math
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
time
import
time
...
@@ -600,5 +601,3 @@ def softmax_preds(images, ckpt_path, return_logits=False):
...
@@ -600,5 +601,3 @@ def softmax_preds(images, ckpt_path, return_logits=False):
tf
.
reset_default_graph
()
tf
.
reset_default_graph
()
return
preds
return
preds
research/differential_privacy/multiple_teachers/input.py
View file @
d5e826e3
...
@@ -24,6 +24,7 @@ import numpy as np
...
@@ -24,6 +24,7 @@ import numpy as np
import
os
import
os
from
scipy.io
import
loadmat
as
loadmat
from
scipy.io
import
loadmat
as
loadmat
from
six.moves
import
urllib
from
six.moves
import
urllib
from
six.moves
import
xrange
import
sys
import
sys
import
tarfile
import
tarfile
...
...
research/differential_privacy/multiple_teachers/train_student.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@ from __future__ import division
...
@@ -19,6 +19,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
differential_privacy.multiple_teachers
import
aggregation
from
differential_privacy.multiple_teachers
import
aggregation
...
...
research/differential_privacy/privacy_accountant/python/gaussian_moments.py
View file @
d5e826e3
...
@@ -40,12 +40,15 @@ To verify that the I1 >= I2 (see comments in GaussianMomentsAccountant in
...
@@ -40,12 +40,15 @@ To verify that the I1 >= I2 (see comments in GaussianMomentsAccountant in
accountant.py for the context), run the same loop above with verify=True
accountant.py for the context), run the same loop above with verify=True
passed to compute_log_moment.
passed to compute_log_moment.
"""
"""
from
__future__
import
print_function
import
math
import
math
import
sys
import
sys
import
numpy
as
np
import
numpy
as
np
import
scipy.integrate
as
integrate
import
scipy.integrate
as
integrate
import
scipy.stats
import
scipy.stats
from
six.moves
import
xrange
from
sympy.mpmath
import
mp
from
sympy.mpmath
import
mp
...
@@ -108,10 +111,10 @@ def compute_a(sigma, q, lmbd, verbose=False):
...
@@ -108,10 +111,10 @@ def compute_a(sigma, q, lmbd, verbose=False):
a_lambda_exact
=
((
1.0
-
q
)
*
a_lambda_first_term_exact
+
a_lambda_exact
=
((
1.0
-
q
)
*
a_lambda_first_term_exact
+
q
*
a_lambda_second_term_exact
)
q
*
a_lambda_second_term_exact
)
if
verbose
:
if
verbose
:
print
"A: by binomial expansion {} = {} + {}"
.
format
(
print
(
"A: by binomial expansion {} = {} + {}"
.
format
(
a_lambda_exact
,
a_lambda_exact
,
(
1.0
-
q
)
*
a_lambda_first_term_exact
,
(
1.0
-
q
)
*
a_lambda_first_term_exact
,
q
*
a_lambda_second_term_exact
)
q
*
a_lambda_second_term_exact
)
)
return
_to_np_float64
(
a_lambda_exact
)
return
_to_np_float64
(
a_lambda_exact
)
...
@@ -125,8 +128,8 @@ def compute_b(sigma, q, lmbd, verbose=False):
...
@@ -125,8 +128,8 @@ def compute_b(sigma, q, lmbd, verbose=False):
b_fn
=
lambda
z
:
(
np
.
power
(
mu0
(
z
)
/
mu
(
z
),
lmbd
)
-
b_fn
=
lambda
z
:
(
np
.
power
(
mu0
(
z
)
/
mu
(
z
),
lmbd
)
-
np
.
power
(
mu
(
-
z
)
/
mu0
(
z
),
lmbd
))
np
.
power
(
mu
(
-
z
)
/
mu0
(
z
),
lmbd
))
if
verbose
:
if
verbose
:
print
"M ="
,
m
print
(
"M ="
,
m
)
print
"f(-M) = {} f(M) = {}"
.
format
(
b_fn
(
-
m
),
b_fn
(
m
))
print
(
"f(-M) = {} f(M) = {}"
.
format
(
b_fn
(
-
m
),
b_fn
(
m
))
)
assert
b_fn
(
-
m
)
<
0
and
b_fn
(
m
)
<
0
assert
b_fn
(
-
m
)
<
0
and
b_fn
(
m
)
<
0
b_lambda_int1_fn
=
lambda
z
:
(
mu0
(
z
)
*
b_lambda_int1_fn
=
lambda
z
:
(
mu0
(
z
)
*
...
@@ -140,9 +143,9 @@ def compute_b(sigma, q, lmbd, verbose=False):
...
@@ -140,9 +143,9 @@ def compute_b(sigma, q, lmbd, verbose=False):
b_bound
=
a_lambda_m1
+
b_int1
-
b_int2
b_bound
=
a_lambda_m1
+
b_int1
-
b_int2
if
verbose
:
if
verbose
:
print
"B: by numerical integration"
,
b_lambda
print
(
"B: by numerical integration"
,
b_lambda
)
print
"B must be no more than "
,
b_bound
print
(
"B must be no more than "
,
b_bound
)
print
b_lambda
,
b_bound
print
(
b_lambda
,
b_bound
)
return
_to_np_float64
(
b_lambda
)
return
_to_np_float64
(
b_lambda
)
...
@@ -188,10 +191,10 @@ def compute_a_mp(sigma, q, lmbd, verbose=False):
...
@@ -188,10 +191,10 @@ def compute_a_mp(sigma, q, lmbd, verbose=False):
a_lambda_second_term
=
integral_inf_mp
(
a_lambda_second_term_fn
)
a_lambda_second_term
=
integral_inf_mp
(
a_lambda_second_term_fn
)
if
verbose
:
if
verbose
:
print
"A: by numerical integration {} = {} + {}"
.
format
(
print
(
"A: by numerical integration {} = {} + {}"
.
format
(
a_lambda
,
a_lambda
,
(
1
-
q
)
*
a_lambda_first_term
,
(
1
-
q
)
*
a_lambda_first_term
,
q
*
a_lambda_second_term
)
q
*
a_lambda_second_term
)
)
return
_to_np_float64
(
a_lambda
)
return
_to_np_float64
(
a_lambda
)
...
@@ -210,8 +213,8 @@ def compute_b_mp(sigma, q, lmbd, verbose=False):
...
@@ -210,8 +213,8 @@ def compute_b_mp(sigma, q, lmbd, verbose=False):
b_fn
=
lambda
z
:
((
mu0
(
z
)
/
mu
(
z
))
**
lmbd_int
-
b_fn
=
lambda
z
:
((
mu0
(
z
)
/
mu
(
z
))
**
lmbd_int
-
(
mu
(
-
z
)
/
mu0
(
z
))
**
lmbd_int
)
(
mu
(
-
z
)
/
mu0
(
z
))
**
lmbd_int
)
if
verbose
:
if
verbose
:
print
"M ="
,
m
print
(
"M ="
,
m
)
print
"f(-M) = {} f(M) = {}"
.
format
(
b_fn
(
-
m
),
b_fn
(
m
))
print
(
"f(-M) = {} f(M) = {}"
.
format
(
b_fn
(
-
m
),
b_fn
(
m
))
)
assert
b_fn
(
-
m
)
<
0
and
b_fn
(
m
)
<
0
assert
b_fn
(
-
m
)
<
0
and
b_fn
(
m
)
<
0
b_lambda_int1_fn
=
lambda
z
:
mu0
(
z
)
*
(
mu0
(
z
)
/
mu
(
z
))
**
lmbd_int
b_lambda_int1_fn
=
lambda
z
:
mu0
(
z
)
*
(
mu0
(
z
)
/
mu
(
z
))
**
lmbd_int
...
@@ -223,8 +226,8 @@ def compute_b_mp(sigma, q, lmbd, verbose=False):
...
@@ -223,8 +226,8 @@ def compute_b_mp(sigma, q, lmbd, verbose=False):
b_bound
=
a_lambda_m1
+
b_int1
-
b_int2
b_bound
=
a_lambda_m1
+
b_int1
-
b_int2
if
verbose
:
if
verbose
:
print
"B by numerical integration"
,
b_lambda
print
(
"B by numerical integration"
,
b_lambda
)
print
"B must be no more than "
,
b_bound
print
(
"B must be no more than "
,
b_bound
)
assert
b_lambda
<
b_bound
+
1e-5
assert
b_lambda
<
b_bound
+
1e-5
return
_to_np_float64
(
b_lambda
)
return
_to_np_float64
(
b_lambda
)
...
...
research/domain_adaptation/domain_separation/dsn_eval.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
import
math
import
math
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
domain_adaptation.datasets
import
dataset_factory
from
domain_adaptation.datasets
import
dataset_factory
...
...
research/gan/cifar/util.py
View file @
d5e826e3
...
@@ -18,6 +18,7 @@ from __future__ import absolute_import
...
@@ -18,6 +18,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
print_function
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
tfgan
=
tf
.
contrib
.
gan
tfgan
=
tf
.
contrib
.
gan
...
...
research/gan/image_compression/networks_test.py
View file @
d5e826e3
...
@@ -19,6 +19,7 @@ from __future__ import division
...
@@ -19,6 +19,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
print_function
import
tensorflow
as
tf
import
tensorflow
as
tf
from
six.moves
import
xrange
import
networks
import
networks
...
...
research/gan/mnist/util.py
View file @
d5e826e3
...
@@ -24,6 +24,7 @@ from __future__ import print_function
...
@@ -24,6 +24,7 @@ from __future__ import print_function
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
ds
=
tf
.
contrib
.
distributions
ds
=
tf
.
contrib
.
distributions
...
...
research/gan/mnist_estimator/train.py
View file @
d5e826e3
...
@@ -22,6 +22,7 @@ import os
...
@@ -22,6 +22,7 @@ import os
import
numpy
as
np
import
numpy
as
np
import
scipy.misc
import
scipy.misc
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
mnist
import
data_provider
from
mnist
import
data_provider
...
...
research/im2txt/README.md
View file @
d5e826e3
...
@@ -119,8 +119,8 @@ First ensure that you have installed the following required packages:
...
@@ -119,8 +119,8 @@ First ensure that you have installed the following required packages:
*
**NumPy**
(
[
instructions
](
http://www.scipy.org/install.html
)
)
*
**NumPy**
(
[
instructions
](
http://www.scipy.org/install.html
)
)
*
**Natural Language Toolkit (NLTK)**
:
*
**Natural Language Toolkit (NLTK)**
:
*
First install NLTK (
[
instructions
](
http://www.nltk.org/install.html
)
)
*
First install NLTK (
[
instructions
](
http://www.nltk.org/install.html
)
)
*
Then install the NLTK data (
[
instructions
](
http://www.nltk.org/data.html
)
)
*
Then install the NLTK data
package "punkt"
(
[
instructions
](
http://www.nltk.org/data.html
)
)
*
**Unzip**
### Prepare the Training Data
### Prepare the Training Data
To train the model you will need to provide training data in native TFRecord
To train the model you will need to provide training data in native TFRecord
...
@@ -145,7 +145,7 @@ available space for storing the downloaded and processed data.
...
@@ -145,7 +145,7 @@ available space for storing the downloaded and processed data.
MSCOCO_DIR
=
"
${
HOME
}
/im2txt/data/mscoco"
MSCOCO_DIR
=
"
${
HOME
}
/im2txt/data/mscoco"
# Build the preprocessing script.
# Build the preprocessing script.
cd
tensorflow-models
/im2txt
cd
research
/im2txt
bazel build //im2txt:download_and_preprocess_mscoco
bazel build //im2txt:download_and_preprocess_mscoco
# Run the preprocessing script.
# Run the preprocessing script.
...
@@ -212,7 +212,7 @@ INCEPTION_CHECKPOINT="${HOME}/im2txt/data/inception_v3.ckpt"
...
@@ -212,7 +212,7 @@ INCEPTION_CHECKPOINT="${HOME}/im2txt/data/inception_v3.ckpt"
MODEL_DIR
=
"
${
HOME
}
/im2txt/model"
MODEL_DIR
=
"
${
HOME
}
/im2txt/model"
# Build the model.
# Build the model.
cd
tensorflow-models
/im2txt
cd
research
/im2txt
bazel build
-c
opt //im2txt/...
bazel build
-c
opt //im2txt/...
# Run the training script.
# Run the training script.
...
@@ -306,7 +306,7 @@ VOCAB_FILE="${HOME}/im2txt/data/mscoco/word_counts.txt"
...
@@ -306,7 +306,7 @@ VOCAB_FILE="${HOME}/im2txt/data/mscoco/word_counts.txt"
IMAGE_FILE
=
"
${
HOME
}
/im2txt/data/mscoco/raw-data/val2014/COCO_val2014_000000224477.jpg"
IMAGE_FILE
=
"
${
HOME
}
/im2txt/data/mscoco/raw-data/val2014/COCO_val2014_000000224477.jpg"
# Build the inference binary.
# Build the inference binary.
cd
tensorflow-models
/im2txt
cd
research
/im2txt
bazel build
-c
opt //im2txt:run_inference
bazel build
-c
opt //im2txt:run_inference
# Ignore GPU devices (only necessary if your GPU is currently memory
# Ignore GPU devices (only necessary if your GPU is currently memory
...
...
research/im2txt/im2txt/data/build_mscoco_data.py
View file @
d5e826e3
...
@@ -97,6 +97,7 @@ import threading
...
@@ -97,6 +97,7 @@ import threading
import
nltk.tokenize
import
nltk.tokenize
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
tf
.
flags
.
DEFINE_string
(
"train_image_dir"
,
"/tmp/train2014/"
,
tf
.
flags
.
DEFINE_string
(
"train_image_dir"
,
"/tmp/train2014/"
,
...
...
research/im2txt/im2txt/evaluate.py
View file @
d5e826e3
...
@@ -76,7 +76,7 @@ def evaluate_model(sess, model, global_step, summary_writer, summary_op):
...
@@ -76,7 +76,7 @@ def evaluate_model(sess, model, global_step, summary_writer, summary_op):
start_time
=
time
.
time
()
start_time
=
time
.
time
()
sum_losses
=
0.
sum_losses
=
0.
sum_weights
=
0.
sum_weights
=
0.
for
i
in
x
range
(
num_eval_batches
):
for
i
in
range
(
num_eval_batches
):
cross_entropy_losses
,
weights
=
sess
.
run
([
cross_entropy_losses
,
weights
=
sess
.
run
([
model
.
target_cross_entropy_losses
,
model
.
target_cross_entropy_losses
,
model
.
target_cross_entropy_loss_weights
model
.
target_cross_entropy_loss_weights
...
@@ -143,7 +143,7 @@ def run_once(model, saver, summary_writer, summary_op):
...
@@ -143,7 +143,7 @@ def run_once(model, saver, summary_writer, summary_op):
global_step
=
global_step
,
global_step
=
global_step
,
summary_writer
=
summary_writer
,
summary_writer
=
summary_writer
,
summary_op
=
summary_op
)
summary_op
=
summary_op
)
except
Exception
,
e
:
# pylint: disable=broad-except
except
Exception
as
e
:
# pylint: disable=broad-except
tf
.
logging
.
error
(
"Evaluation failed."
)
tf
.
logging
.
error
(
"Evaluation failed."
)
coord
.
request_stop
(
e
)
coord
.
request_stop
(
e
)
...
...
research/im2txt/im2txt/run_inference.py
View file @
d5e826e3
...
@@ -70,7 +70,7 @@ def main(_):
...
@@ -70,7 +70,7 @@ def main(_):
generator
=
caption_generator
.
CaptionGenerator
(
model
,
vocab
)
generator
=
caption_generator
.
CaptionGenerator
(
model
,
vocab
)
for
filename
in
filenames
:
for
filename
in
filenames
:
with
tf
.
gfile
.
GFile
(
filename
,
"r"
)
as
f
:
with
tf
.
gfile
.
GFile
(
filename
,
"r
b
"
)
as
f
:
image
=
f
.
read
()
image
=
f
.
read
()
captions
=
generator
.
beam_search
(
sess
,
image
)
captions
=
generator
.
beam_search
(
sess
,
image
)
print
(
"Captions for image %s:"
%
os
.
path
.
basename
(
filename
))
print
(
"Captions for image %s:"
%
os
.
path
.
basename
(
filename
))
...
...
research/learned_optimizer/metaopt.py
View file @
d5e826e3
...
@@ -21,6 +21,7 @@ import sys
...
@@ -21,6 +21,7 @@ import sys
import
time
import
time
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
learned_optimizer.optimizer
import
trainable_optimizer
from
learned_optimizer.optimizer
import
trainable_optimizer
...
...
research/learning_to_remember_rare_events/data_utils.py
View file @
d5e826e3
...
@@ -29,6 +29,7 @@ import numpy as np
...
@@ -29,6 +29,7 @@ import numpy as np
from
scipy.misc
import
imresize
from
scipy.misc
import
imresize
from
scipy.misc
import
imrotate
from
scipy.misc
import
imrotate
from
scipy.ndimage
import
imread
from
scipy.ndimage
import
imread
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
research/learning_to_remember_rare_events/memory.py
View file @
d5e826e3
...
@@ -23,6 +23,7 @@ published as a conference paper at ICLR 2017.
...
@@ -23,6 +23,7 @@ published as a conference paper at ICLR 2017.
"""
"""
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
research/learning_to_remember_rare_events/train.py
View file @
d5e826e3
...
@@ -26,6 +26,7 @@ import os
...
@@ -26,6 +26,7 @@ import os
import
random
import
random
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
import
data_utils
import
data_utils
...
...
research/lfads/synth_data/generate_itb_data.py
View file @
d5e826e3
...
@@ -18,6 +18,7 @@ from __future__ import print_function
...
@@ -18,6 +18,7 @@ from __future__ import print_function
import
h5py
import
h5py
import
numpy
as
np
import
numpy
as
np
import
os
import
os
from
six.moves
import
xrange
import
tensorflow
as
tf
import
tensorflow
as
tf
from
utils
import
write_datasets
from
utils
import
write_datasets
...
@@ -47,12 +48,12 @@ flags.DEFINE_float("max_firing_rate", 30.0,
...
@@ -47,12 +48,12 @@ flags.DEFINE_float("max_firing_rate", 30.0,
flags
.
DEFINE_float
(
"u_std"
,
0.25
,
flags
.
DEFINE_float
(
"u_std"
,
0.25
,
"Std dev of input to integration to bound model"
)
"Std dev of input to integration to bound model"
)
flags
.
DEFINE_string
(
"checkpoint_path"
,
"SAMPLE_CHECKPOINT"
,
flags
.
DEFINE_string
(
"checkpoint_path"
,
"SAMPLE_CHECKPOINT"
,
"""Path to directory with checkpoints of model
"""Path to directory with checkpoints of model
trained on integration to bound task. Currently this
trained on integration to bound task. Currently this
is a placeholder which tells the code to grab the
is a placeholder which tells the code to grab the
checkpoint that is provided with the code
checkpoint that is provided with the code
(in /trained_itb/..). If you have your own checkpoint
(in /trained_itb/..). If you have your own checkpoint
you would like to restore, you would point it to
you would like to restore, you would point it to
that path."""
)
that path."""
)
FLAGS
=
flags
.
FLAGS
FLAGS
=
flags
.
FLAGS
...
...
research/lfads/synth_data/generate_labeled_rnn_data.py
View file @
d5e826e3
...
@@ -18,6 +18,7 @@ from __future__ import print_function
...
@@ -18,6 +18,7 @@ from __future__ import print_function
import
os
import
os
import
h5py
import
h5py
import
numpy
as
np
import
numpy
as
np
from
six.moves
import
xrange
from
synthetic_data_utils
import
generate_data
,
generate_rnn
from
synthetic_data_utils
import
generate_data
,
generate_rnn
from
synthetic_data_utils
import
get_train_n_valid_inds
from
synthetic_data_utils
import
get_train_n_valid_inds
...
...
Prev
1
2
3
4
5
6
7
8
Next
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