W3A1: Extraneous TensorflowOpLayer intances

Hi. I am working on C5W3A1, and the unit test modelf_test is failing because of a whole bunch of TensorflowOpLayer instances in the TF graph. All the other ops match (but in different order), and the Activation (which I assume should be the softmax in one_step_attention appears to be AWOL. Overall the model summary looks like this:

[[‘InputLayer’, [(None, 64)], 0], [‘InputLayer’, [(None, 30, 37)], 0], [‘RepeatVector’, (None, 30, 64), 0, 30], [‘Bidirectional’, (None, 30, 64), 17920], [‘Concatenate’, (None, 30, 128), 0], [‘Dense’, (None, 30, 10), 1290, ‘tanh’], [‘Dense’, (None, 30, 1), 11, ‘relu’], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘Dot’, (None, 1, 64), 0], [‘InputLayer’, [(None, 64)], 0], [‘LSTM’, [(None, 64), (None, 64), (None, 64)], 33024, [(None, 1, 64), (None, 64), (None, 64)], ‘tanh’], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘TensorFlowOpLayer’, [(None, 1, 1)], 0], [‘TensorFlowOpLayer’, [(None, 30, 1)], 0], [‘Dense’, (None, 11), 715, ‘softmax’]]

I have stared at this code for a long time, trying to find something wrong, but have finally given up. Please help.

NM. Found the problem as soon as I posted this message. I was using softmax directly instead of using the global instance.

You should be using the output_layer() function. It’s defined in a cell that’s at the begining of Exercise 2. That’s where the Dense layer is defined with the appropriate activation.