IndexError: list index out of range
Maybe you are not using the attention.py you think you are using. The error states that the problematic line in Attention build is:

shape=tf.TensorShape((input_shape[0][3], input_shape[0][3])),

but the code of attention.py you shared with us does not seem to contain such line.
It is possible you also just forgot to save your changes to the new attention.py file.