Skip to content

Commit 3653ef1

Browse files
Merge pull request tensorflow#2603 from charlesreid1/master
Consistent, fixed-width printing from adversarial crypto example.
2 parents 6827532 + a0d771b commit 3653ef1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

research/adversarial_crypto/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ Cryptography"](https://arxiv.org/abs/1610.06918).
1616
> encryption and decryption, and also how to apply these operations
1717
> selectively in order to meet confidentiality goals.
1818
19-
This code allows you to train an encoder/decoder/adversary triplet
19+
This code allows you to train encoder/decoder/adversary network triplets
2020
and evaluate their effectiveness on randomly generated input and key
2121
pairs.
2222

2323
## Prerequisites
2424

2525
The only software requirements for running the encoder and decoder is having
26-
Tensorflow installed.
26+
TensorFlow installed.
2727

28-
Requires Tensorflow r0.12 or later.
28+
Requires TensorFlow r0.12 or later.
2929

3030
## Training and evaluating
3131

@@ -49,8 +49,8 @@ of two. In the version in the paper, there was a nonlinear unit
4949
after the fully-connected layer; that nonlinear has been removed
5050
here. These changes improve the robustness of training. The
5151
initializer for the convolution layers has switched to the
52-
tf.contrib.layers default of xavier_initializer instead of
53-
a simpler truncated_normal.
52+
`tf.contrib.layers default` of `xavier_initializer` instead of
53+
a simpler `truncated_normal`.
5454

5555
## Contact information
5656

research/adversarial_crypto/train_eval.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_message_and_key(self):
117117
return in_m, in_k
118118

119119
def model(self, collection, message, key=None):
120-
"""The model for Alice, Bob, and Eve. If key=None, the first FC layer
120+
"""The model for Alice, Bob, and Eve. If key=None, the first fully connected layer
121121
takes only the message as inputs. Otherwise, it uses both the key
122122
and the message.
123123
@@ -206,7 +206,7 @@ def doeval(s, ac, n, itercount):
206206
itercount: Iteration count label for logging.
207207
208208
Returns:
209-
Bob and eve's loss, as a percent of bits incorrect.
209+
Bob and Eve's loss, as a percent of bits incorrect.
210210
"""
211211

212212
bob_loss_accum = 0
@@ -217,7 +217,7 @@ def doeval(s, ac, n, itercount):
217217
eve_loss_accum += el
218218
bob_loss_percent = bob_loss_accum / (n * FLAGS.batch_size)
219219
eve_loss_percent = eve_loss_accum / (n * FLAGS.batch_size)
220-
print('%d %.2f %.2f' % (itercount, bob_loss_percent, eve_loss_percent))
220+
print('%10d\t%20.2f\t%20.2f'%(itercount, bob_loss_percent, eve_loss_percent))
221221
sys.stdout.flush()
222222
return bob_loss_percent, eve_loss_percent
223223

@@ -245,7 +245,7 @@ def train_and_evaluate():
245245
with tf.Session() as s:
246246
s.run(init)
247247
print('# Batch size: ', FLAGS.batch_size)
248-
print('# Iter Bob_Recon_Error Eve_Recon_Error')
248+
print('# %10s\t%20s\t%20s'%("Iter","Bob_Recon_Error","Eve_Recon_Error"))
249249

250250
if train_until_thresh(s, ac):
251251
for _ in xrange(EVE_EXTRA_ROUNDS):

0 commit comments

Comments
 (0)