Your code would work and you call mean() to get the ratio (or sum() to get the number of elements meeting the condition).
Something like this might work:
output = torch.randn(10, 10)
target = torch.randn(10, 10)
res = torch.abs(output - target) <= 0.1*target
res.float().mean()
res.float().sum()