I have two 2d tensors like this:
x = tensor([[1311, 1297, 3872, 1299, 1445, 1299, 3876, 1298, 2],
[1316, 1301, 3872, 1804, 1326, 3875, 1378, 1298, 2] ]])
y = tensor([[1311, 1297, 1, 1299, 1445, 1299, 2, 1298, 2],
[1316, 1301, 1, 1804, 1326, 2, 1378, 1298, 2] ]])
The tensors differ from each other at some indices and I want another tensor to be updated based on the values in these tensors at differing positions. i.e.,
z= tensor([[ 2, 16, 17, 10, 12, 13, 3876, 3872, 10, 14],
[ 2, 16, 17, 10, 12, 13, 3875, 3872, 10, 14]]])
z should become:
z= tensor([[ 2, 16, 17, 10, 12, 13, 2, 1, 10, 14],
[ 2, 16, 17, 10, 12, 13, 2, 1, 10, 14]]])
How can this be done?