qml.QNSPSAOptimizer() giving AttributeError: 'function' object has no attribute 'construct'

@CatalinaAlbornoz Thank you for your response. I did encoded as you are saying. But it did not work. Although, the recent query QNSPSA error using a dataset
is exactly the same I am doing. I am not sure how they solved the problem of QNSPSA optimizer. Hope it can help at your end.