AttributeError: 'NoneType' object has no attribute 'data'

This is the case as mentioned before. Integer types are not differentiable since their gradient would be zero almost everywhere and undefined at the rounding point (or inf). @KFrank explains it in more detail here.