Course3 week2 exercise 5 getting errors

can you please slove the problem i am sharing my lab id ovjmmmqa

NameError Traceback (most recent call last)
in
5 batch = next(data_generator(batch_size, max_length, lines, shuffle=False))
6 preds = model(batch[0])
----> 7 log_ppx = test_model(preds, batch[1])
8 print(‘The log perplexity and perplexity of your model are respectively’, log_ppx, np.exp(log_ppx))

in test_model(preds, target)
16
17 non_pad = 1.0 - np.equal(target, 0) # You should check if the target equals 0
—> 18 log_p = total_log_ppx * non_pad # Get rid of the padding
19
20 log_ppx = np.sum(ppx) / np.sum(non_pad) # Remember to set the axis properly when summing up

NameError: name ‘total_log_ppx’ is not defined

The trace back tells you the error you are making.

You are using a variable total_log_ppx which is not defined/initialised within the function (nor that this variable is required)