def torch_nanmean(x):
num = torch.where(torch.isnan(x), torch.full_like(x, 0), torch.full_like(x, 1)).sum()
value = torch.where(torch.isnan(x), torch.full_like(x, 0), x).sum()
return value / num
def torch_nanmean(x):
num = torch.where(torch.isnan(x), torch.full_like(x, 0), torch.full_like(x, 1)).sum()
value = torch.where(torch.isnan(x), torch.full_like(x, 0), x).sum()
return value / num