I’ve solved the problem. The error occurred in another function.
 def MySignFun(self, vx):
        res = Variable(torch.zeros_like(vx).cuda(), requires_grad=True)
        for index, data in enumerate(vx, 0):
            res[index] = torch.FloatTensor([self.signJudge(x) for x in data])
        return res

change the statement
        res = Variable(torch.zeros_like(vx).cuda(), requires_grad=True)

to:
        res = Variable(torch.zeros_like(vx).cuda())


and then, it works.
Hope to help you if you encountered the same problem.