Update CopySlices to not internal assert when grad_output is undefined (#108353)
Fixes https://github.com/pytorch/pytorch/issues/107928
Pull Request resolved: https://github.com/pytorch/pytorch/pull/108353
Approved by: https://github.com/albanD
ghstack dependencies: #107296, #107349