Input is n tensors, and I define my network as following:
generators = []
for i in range(n):
    main = nn.Sequential()
    main.add_module("some_module", some_module)
    generators.append(main)

And in forward part, each tensor from input is multiplied with generators[i] to produce output. However, error message “RuntimeError: Input type (CUDAFloatTensor) and weight type (CPUFloatTensor) should be the same” is produced when I run the code. It seems that “generators” is not added to my model, and thus weights inside “generators” are not initialized to be CUDA tensor. Is there a way to initialize weights to be CUDA tensor? Thanks.