Hi,
Is there any suggestion about how I can implement below conditions for kc which is a tensor in pytorch?
following conditions give this error:
“Boolean value of Tensor with more than one value is ambiguous.”
net_in = torch.cat((x,y),1)
kc = net2_kc(net_in)
kc = kc.view(len(kc),-1)
if kc>0.5:
f = (kc-0.5)^2
elif 0 <= kc <= 0.5:
f = 0
else:
f = kc^2
and then I need to add f function to my loss function.