parameters: (model, src_sents, tgt_sents, vocab)
docstring: Sanity check for question 1f. 
          Compares student output to that of model with dummy data.
docstring_summary: Sanity check for question 1f. 
          Compares student output to that of model with dummy data.
docstring_tokens: Sanity check for question 1f . Compares student output to that of model with dummy data .
function: def question_1f_sanity_check(model, src_sents, tgt_sents, vocab):
      """ Sanity check for question 1f. 
          Compares student output to that of model with dummy data.
      """
      print ("-"*80)
      print("Running Sanity Check for Question 1f: Step")
      print ("-"*80)
      reinitialize_layers(model)
  
      # Inputs
      Ybar_t = torch.load('./sanity_check_en_es_data/Ybar_t.pkl')
      dec_init_state = torch.load('./sanity_check_en_es_data/dec_init_state.pkl')
      enc_hiddens = torch.load('./sanity_check_en_es_data/enc_hiddens.pkl')
      enc_masks = torch.load('./sanity_check_en_es_data/enc_masks.pkl')
      enc_hiddens_proj = torch.load('./sanity_check_en_es_data/enc_hiddens_proj.pkl')
  
      # Output
      dec_state_target = torch.load('./sanity_check_en_es_data/dec_state.pkl')
      o_t_target = torch.load('./sanity_check_en_es_data/o_t.pkl')
      e_t_target = torch.load('./sanity_check_en_es_data/e_t.pkl')
  
      # Run Tests
      with torch.no_grad():
          dec_state_pred, o_t_pred, e_t_pred= model.step(Ybar_t, dec_init_state, enc_hiddens, enc_hiddens_proj, enc_masks)
      assert(np.allclose(dec_state_target[0].numpy(), dec_state_pred[0].numpy())), "decoder_state[0] is incorrect: it should be:\n {} but is:\n{}".format(dec_state_target[0], dec_state_pred[0])
      print("dec_state[0] Sanity Checks Passed!")
      assert(np.allclose(dec_state_target[1].numpy(), dec_state_pred[1].numpy())), "decoder_state[1] is incorrect: it should be:\n {} but is:\n{}".format(dec_state_target[1], dec_state_pred[1])
      print("dec_state[1] Sanity Checks Passed!")
      assert(np.allclose(o_t_target.numpy(), o_t_pred.numpy())), "combined_output is incorrect: it should be:\n {} but is:\n{}".format(o_t_target, o_t_pred)
      print("combined_output  Sanity Checks Passed!")
      assert(np.allclose(e_t_target.numpy(), e_t_pred.numpy())), "e_t is incorrect: it should be:\n {} but is:\n{}".format(e_t_target, e_t_pred)
      print("e_t Sanity Checks Passed!")
      print ("-"*80)    
      print("All Sanity Checks Passed for Question 1f: Step!")
      print ("-"*80)
function_tokens: def question_1f_sanity_check ( model , src_sents , tgt_sents , vocab ) : print ( "-" * 80 ) print ( "Running Sanity Check for Question 1f: Step" ) print ( "-" * 80 ) reinitialize_layers ( model ) # Inputs Ybar_t = torch . load ( './sanity_check_en_es_data/Ybar_t.pkl' ) dec_init_state = torch . load ( './sanity_check_en_es_data/dec_init_state.pkl' ) enc_hiddens = torch . load ( './sanity_check_en_es_data/enc_hiddens.pkl' ) enc_masks = torch . load ( './sanity_check_en_es_data/enc_masks.pkl' ) enc_hiddens_proj = torch . load ( './sanity_check_en_es_data/enc_hiddens_proj.pkl' ) # Output dec_state_target = torch . load ( './sanity_check_en_es_data/dec_state.pkl' ) o_t_target = torch . load ( './sanity_check_en_es_data/o_t.pkl' ) e_t_target = torch . load ( './sanity_check_en_es_data/e_t.pkl' ) # Run Tests with torch . no_grad ( ) : dec_state_pred , o_t_pred , e_t_pred = model . step ( Ybar_t , dec_init_state , enc_hiddens , enc_hiddens_proj , enc_masks ) assert ( np . allclose ( dec_state_target [ 0 ] . numpy ( ) , dec_state_pred [ 0 ] . numpy ( ) ) ) , "decoder_state[0] is incorrect: it should be:\n {} but is:\n{}" . format ( dec_state_target [ 0 ] , dec_state_pred [ 0 ] ) print ( "dec_state[0] Sanity Checks Passed!" ) assert ( np . allclose ( dec_state_target [ 1 ] . numpy ( ) , dec_state_pred [ 1 ] . numpy ( ) ) ) , "decoder_state[1] is incorrect: it should be:\n {} but is:\n{}" . format ( dec_state_target [ 1 ] , dec_state_pred [ 1 ] ) print ( "dec_state[1] Sanity Checks Passed!" ) assert ( np . allclose ( o_t_target . numpy ( ) , o_t_pred . numpy ( ) ) ) , "combined_output is incorrect: it should be:\n {} but is:\n{}" . format ( o_t_target , o_t_pred ) print ( "combined_output  Sanity Checks Passed!" ) assert ( np . allclose ( e_t_target . numpy ( ) , e_t_pred . numpy ( ) ) ) , "e_t is incorrect: it should be:\n {} but is:\n{}" . format ( e_t_target , e_t_pred ) print ( "e_t Sanity Checks Passed!" ) print ( "-" * 80 ) print ( "All Sanity Checks Passed for Question 1f: Step!" ) print ( "-" * 80 )