Thank you very much.
I have found the following solution:
res = (image >= 180)
res = res.type(torch.int)
hv = (torch.sum(res, dim=0) >=1)
wv = (torch.sum(res, dim=1) >=1)

Pytorch is great. Much more friendly then tensorflow. It requires different mindset, but the results are great.
Thanks, for help.