Solved by vikrant_karale in post #2 
              
              
                It is resolved now. It was due to type of second argument in nms. I converted the second argument to torch tensor in nms and it is working fine.