Guest User

Untitled

a guest
May 20th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #PUT THIS IN A SEPARATE CELL
  2. !pip install -U tensorboardcolab
  3. import numpy as np
  4. import tensorflow as tf
  5. import matplotlib.pyplot as plt
  6. from tensorboardcolab import *
  7. import shutil
  8.  
  9. import os
  10.  
  11. #PUT THIS IN A SEPARATE CELL
  12. tbc=TensorBoardColab()
  13.  
  14. #PUT THIS IN A SEPARATE CELL
  15. shutil.rmtree('./Graph',ignore_errors=True)
  16. os.mkdir('./Graph')
  17. maped = [16, 18, 5, 16, 1, 18, 5, 27, 20, 15, 27, 14, 5, 7, 15, 20, 9, 1, 20, 5, 0 ]
  18. print('initial :')
  19. print(maped)
  20.  
  21. tf.reset_default_graph()
  22. t_input = tf.placeholder(tf.float32, name='input_node')
  23.  
  24. t_reshaped = tf.reshape(t_input, [3, -1], name='reshape_input_vector');
  25.  
  26. t_key = tf.constant([[-3, -3, -4],
  27. [0, 1, 1],
  28. [4, 3, 4]], tf.float32)
  29.  
  30. t_encrypted_rolled = tf.matmul(t_key, t_reshaped);
  31.  
  32. t_encrypted = tf.squeeze(tf.reshape(t_encrypted_rolled ,
  33. [1, -1],
  34. name='reshepa_to_output_vector'));
  35.  
  36. with tf.Session() as sess:
  37. sess.run(tf.global_variables_initializer());
  38. encrypted = sess.run(t_encrypted,
  39. feed_dict={t_input:maped}, run_metadata={})
  40.  
  41. train_writer = tbc.get_writer();
  42. train_writer.add_graph(sess.graph)
  43. train_writer.flush();
  44.  
  45. print('encrypted version: ')
  46. print(encrypted)
Add Comment
Please, Sign In to add comment