So, I followed this answer on SO
I'm trying to equate two tensors
torch.equal(x_valid[0], x_valid[:1])
returns False
whereas
torch.all(torch.eq(x_valid[0], x_valid[:1]))
returns tensor(1, dtype=torch.uint8)
I know for a fact that both tensors are same like first value of x_valid
so why torch.equal returns False
?
except the fact that x_valid[0]
returns ([0, 0, ...,0])
& x_valid[:1]
returns ([[0, 0, ...,0]])
but type of both of them is still tensor
. So I can't really understand why the output of first query is False