How to mask tensor with boolean using c++ api? how to achieve this python code with c++ api?

arr_t = [
            [0,0,1,1,1,0,0],
            [0,0,1,0,1,0,0],
            [0,0,1,0,1,0,3],
            [0,0,1,0,1,0,3],
            [0,0,1,1,1,0,3]
        ]

mask = [
            [0,0,1,1,1,0,0],
            [0,0,1,0,1,0,0],
            [0,0,1,1,1,0,0],
            [0,0,1,0,1,0,0],
            [0,0,1,1,1,0,0]
        ]
t1 = torch.IntTensor(arr_t).to(torch.int8)
t2 = torch.IntTensor(mask).to(torch.int8)
t3 = t2 >0
t1[t3] = t2[t3]   # when using c++ this line can't be success
print(t1)
tensor([[0, 0, 1, 1, 1, 0, 0],
        [0, 0, 1, 0, 1, 0, 0],
        [0, 0, 1, 1, 1, 0, 3],
        [0, 0, 1, 0, 1, 0, 3],
        [0, 0, 1, 1, 1, 0, 3]], dtype=torch.int8)

use masked_scatter function can do that