Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #PUT THIS IN A SEPARATE CELL
- !pip install -U tensorboardcolab
- import numpy as np
- import tensorflow as tf
- import matplotlib.pyplot as plt
- from tensorboardcolab import *
- import shutil
- import os
- #PUT THIS IN A SEPARATE CELL
- tbc=TensorBoardColab()
- #PUT THIS IN A SEPARATE CELL
- shutil.rmtree('./Graph',ignore_errors=True)
- os.mkdir('./Graph')
- maped = [16, 18, 5, 16, 1, 18, 5, 27, 20, 15, 27, 14, 5, 7, 15, 20, 9, 1, 20, 5, 0 ]
- print('initial :')
- print(maped)
- tf.reset_default_graph()
- t_input = tf.placeholder(tf.float32, name='input_node')
- t_reshaped = tf.reshape(t_input, [3, -1], name='reshape_input_vector');
- t_key = tf.constant([[-3, -3, -4],
- [0, 1, 1],
- [4, 3, 4]], tf.float32)
- t_encrypted_rolled = tf.matmul(t_key, t_reshaped);
- t_encrypted = tf.squeeze(tf.reshape(t_encrypted_rolled ,
- [1, -1],
- name='reshepa_to_output_vector'));
- with tf.Session() as sess:
- sess.run(tf.global_variables_initializer());
- encrypted = sess.run(t_encrypted,
- feed_dict={t_input:maped}, run_metadata={})
- train_writer = tbc.get_writer();
- train_writer.add_graph(sess.graph)
- train_writer.flush();
- print('encrypted version: ')
- print(encrypted)
Add Comment
Please, Sign In to add comment