I don’t understand the function, except it is some custom-made loss. But as far as I can tell, the author of the function was sure the input will have 1st dimension. It could be possible that while copying the function rs_center_ and rs_center were misplaced.