When cuda() is called, a list of modules cannot shift to the GPU
Hi, below is my definition of network: <SCODE>class  CNN_Text(nn.Module):
    
    def __init__(self, args):
        super(CNN_Text,self).__init__()
        self.args = args
        
        V = args.embed_num
        D = args.embed_dim
        C = args.class_num
        Ci = 1
        Co = args.kernel_num
        Ks = args.kernel_sizes

        self.embed = nn.Embedding(V, D)
        self.convs1 = [nn.Conv2d(Ci, Co, (K, D)) for K in Ks]

        self.dropout = nn.Dropout(args.dropout)
        self.fc1 = nn.Linear(len(Ks)*Co, C)
<ECODE> However, when i called cuda() on the model, the modules in the  list self.convs1 will not shift to the GPU, how to solve this problem, any ideas ?
xinwei_he
jekbradbury
thanksm but it gives me the error <SCODE>AttributeError: 'module' object has no attribute 'ModuleList'
<ECODE> is it a problem related to the version of pytorch?
xinwei_he
Many Thanks, it solves my problem. And Updating my pytorch makes ModuleList available.
xinwei_he