关于 pytorch中Tensor数据类型的使用问题

原文中的代码:

if condi_inputs:
                    condi_inputs = torch.cat((condi_inputs, condi_inputs))

报错提示:

RuntimeError: bool value of Tensor with more than one value is ambiguous

这里的condi_inputs是一个Tensor变量,然后就不是很清楚这个IF想判定什么内容,也不知道该怎么更改,不知道有没有大神可以私下解决一下。

代码GITHUB地址:源代码地址

condi_inputs这个Tensor包含不止一个值,不能当作 bool值用于 if 语句,试试这样改动:

if condi_inputs is not None:
                    condi_inputs = torch.cat((condi_inputs, condi_inputs))