I need a Torch command that checks if two tensors have the same content, and returns TRUE if they have the same content.
For example:
local tens_a = torch.Tensor({9,8,7,6});
local tens_b = torch.Tensor({9,8,7,6});
if (tens_a EQUIVALENCE_COMMAND tens_b) then ... end
What should I use in this script instead of EQUIVALENCE_COMMAND
?
I tried simply with ==
but it does not work.
https://github.com/torch/torch7/blob/master/doc/maths.md#torcheqa-b
torch.eq(a, b)
Implements == operator comparing each element in a with b (if b is a number) or each element in a with corresponding element in b.
from @deltheil
torch.all(torch.eq(tens_a, tens_b))
or even simpler
torch.all(tens_a.eq(tens_b))