目录
pytorch 筛选数据(使用与或)
import torch
x = torch.linspace(1, 8, steps=8).view(4, 2)
print(x)
area1=(x[:,0]>5.5)&(x[:,1]>5.5)
c=x[:,0]*x[:,1]
area2=c>25
area=area1|area2
print(x[area])
if 0:
# index=torch.max(area,1)[0]
b=x[area]
# b= x[torch.where((x[:,0]>0) & (x[:,0]<6))]
# print(b)
pytorch筛选赋值
def cross_entropy_loss_RCF(prediction, labelf, beta):
label &#