It sounds like you’re trying to do the following:
tensor  # some random tensor
if tensor == 1:
    pass   # do something else

The error above happens when you’re trying to treat a ByteTensor (the result of a comparison) as a boolean.