(decoder)
Sanity check for CharDecoder.train_forward()
        basic shape check
Sanity check for CharDecoder.train_forward()
        basic shape check
Sanity check for CharDecoder . train_forward () basic shape check
def question_2b_sanity_check(decoder):
    """ Sanity check for CharDecoder.train_forward()
        basic shape check
    """
    print ("-"*80)
    print("Running Sanity Check for Question 2b: CharDecoder.train_forward()")
    print ("-"*80)
    sequence_length = 4
    inpt = torch.zeros(sequence_length, BATCH_SIZE, dtype=torch.long)
    loss = decoder.train_forward(inpt)
    assert(list(loss.size()) == []), "Loss should be a scalar but its shape is: {}".format(list(loss.size()))
    print("Sanity Check Passed for Question 2b: CharDecoder.train_forward()!")
    print("-"*80)
def question_2b_sanity_check ( decoder ) : print ( "-" * 80 ) print ( "Running Sanity Check for Question 2b: CharDecoder.train_forward()" ) print ( "-" * 80 ) sequence_length = 4 inpt = torch . zeros ( sequence_length , BATCH_SIZE , dtype = torch . long ) loss = decoder . train_forward ( inpt ) assert ( list ( loss . size ( ) ) == [ ] ) , "Loss should be a scalar but its shape is: {}" . format ( list ( loss . size ( ) ) ) print ( "Sanity Check Passed for Question 2b: CharDecoder.train_forward()!" ) print ( "-" * 80 )