simplify beam search code
simplify beam search code

Summary: This cleans up the _hack_get_slice_end() using the Conditional operator.

Reviewed By: jmp84

Differential Revision: D6177797

fbshipit-source-id: 5ce0b76b8472123415bba39488aa2c69aad96111

sf-wind/caffe2,pietern/caffe2,Yangqing/caffe2,xzturn/caffe2,xzturn/caffe2,Yangqing/caffe2,sf-wind/caffe2,pietern/caffe2,Yangqing/caffe2,davinwang/caffe2,sf-wind/caffe2,pietern/caffe2,davinwang/caffe2,sf-wind/caffe2,xzturn/caffe2,pietern/caffe2,davinwang/caffe2,caffe2/caffe2,pietern/caffe2,xzturn/caffe2,davinwang/caffe2,Yangqing/caffe2,davinwang/caffe2,sf-wind/caffe2,Yangqing/caffe2,xzturn/caffe2