Guest User

Untitled

a guest
Mar 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. batch_size = 100
  2. handle_mix = tf.placeholder(tf.float64, shape=[])
  3. handle_src0 = tf.placeholder(tf.float64, shape=[])
  4. handle_src1 = tf.placeholder(tf.float64, shape=[])
  5. handle_src2 = tf.placeholder(tf.float64, shape=[])
  6. handle_src3 = tf.placeholder(tf.float64, shape=[])
  7.  
  8. dataset = tf.data.Dataset.from_tensor_slices(
  9. {"x_mixed":padded_lbl, "y_src0": padded_src[0], "y_src1": padded_src[1],"y_src2": padded_src[1], "y_src3": padded_src[1]})
  10.  
  11. dataset = dataset.shuffle(1000).repeat().batch(batch_size)
  12.  
  13. iterator = tf.data.Iterator.from_structure(dataset.output_types, dataset.output_shapes)
  14.  
  15. next_element = iterator.get_next()
  16.  
  17. training_init_op = iterator.make_initializer(dataset)
  18. for _ in range(20):
  19. # Initialize an iterator over the training dataset.
  20. sess.run(training_init_op)
  21. for _ in range(100):
  22. sess.run(next_element)
  23.  
  24. l, _, summary = sess.run([loss_fn, optimizer, summary_op], feed_dict={handle_mix: batch_mix, handle_src0: batch_src0,
  25. handle_src1: batch_src1, handle_src2: batch_src2, handle_src3: batch_src3})
Add Comment
Please, Sign In to add comment