Guest User

Untitled

a guest
Nov 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. def Generate():
  2. i = 0
  3.  
  4. while 1:
  5. i = i%int(Numb/batch_size)
  6. my_input_batch = my_input[i*batch_size : (i+1)*batch_size]
  7. my_output_batch = my_output[i*batch_size : (i+1)*batch_size]
  8. encoder_input_data = np.array(np.zeros((batch_size, max_encoder_text_length, num_dictonary),dtype='float32'))
  9. decoder_input_data = np.array(np.zeros((batch_size, max_decoder_text_length, num_dictonary),dtype='float32'))
  10. decoder_target_data = np.array(np.zeros((batch_size, max_decoder_text_length, num_dictonary),dtype='float32'))
  11.  
  12. for i, (text_input, text_output) in enumerate(zip(my_input_batch, my_output_batch)):
  13. for t, word in enumerate(my_input_batch):
  14. encoder_input_data[i, t, word] = 1.
  15. for t, word in enumerate(my_output_batch):
  16. decoder_input_data[i, t, word] = 1.
  17. if t > 0:
  18. decoder_target_data[i, t - 1, word] = 1.
  19. i = i + 1
  20. yield ({encoder_input_data, decoder_input_data}, {decoder_target_data})
  21.  
  22. File "test.py", line 146, in Generate
  23. yield ({encoder_input_data, decoder_input_data}, {decoder_target_data})
  24. TypeError: unhashable type: 'numpy.ndarray'
Add Comment
Please, Sign In to add comment