Np.where and indiscriminate use of torch.where

两者都是三个输入参数,第一个是判断条件,第二个是符合条件的设置值,第三个是不满足条件的设置值。

The difference is that, torch want to set the values ​​of all the types of Tensor

mask_true = torch.where(torch.isnan(y_true), torch.full_like(y_true, 0), torch.full_like(y_true, 1))
mask_true = np.where(np.isnan(y_true), 0, 1)

 

Published 38 original articles · 98 won praise · views 360 000 +

Guess you like

Origin blog.csdn.net/xijuezhu8128/article/details/86590562