One simple solution is as follows:
>>> a = torch.randn(10)
>>> a
tensor([-0.7635,  0.1626, -0.2671,  0.6118,  0.0304,  1.3959, -1.0044, -0.7236,
        -1.1573, -0.4817]
>>> aw = a > 0
>>> aw
tensor([0, 1, 0, 1, 1, 1, 0, 0, 0, 0], dtype=torch.uint8)
>>> torch.sum(a * aw.float()) / torch.sum(aw)
tensor(0.5502)