Solved by KevNull in post #2 
              
              
                is module->forward(inputs) returning a tensor, or a tuple of tensors? You might need to unpack the tuple before calling toTensor() from something it contained.