pytorch利用类似掩码的功能把一些值置为0

在pytorch中,简单利用float()生成掩码,然后过滤掉不想用的值,保存维度不变。

原文地址:https://www.cnblogs.com/vvzhang/p/14920216.html