RuntimeError: Cannot access data pointer of Tensor that doesn't have storage

Seeing "RuntimeError: Cannot access data pointer of Tensor that doesn’t have storage " during loss.backward (inputs = [ a batchnorm param] , retain_graph=True) . Non-BN layers seem to have no such issue. Would appreciate an explanation and a fix.

Could you post a minimal and executable code snippet reproducing this issue?