I am not exactly using bool. I am trying to run facebook’s end to end negotiator code, where the following snippet produces a problem:

    if resume:
        inpt = None
    else:
        inpt = Variable(torch.LongTensor(1))
        inpt.data.fill_(self.word_dict.get_idx('YOU:'))
        inpt = self.to_device(inpt)

    for _ in range(max_words):
            if inpt:   #this condition produces the error when inpt is not None
                inpt_emb = torch.cat([self.word_encoder(inpt), ctx_h], 1)
                lang_h = self.writer(inpt_emb, lang_h)
                lang_hs.append(lang_h)