Hey all,
I am working on a Model in which a layer takes two inputs.
The first input is part of the input data, and the second input are embeddings (of other input data.)
I’ve tried to combine the two using torch.concat(), which returns a tensor.
That tensor however cannot be used downstream without modifications;
I receive errors like
TypeError: cannot assign 'torch.FloatTensor' as child module 'l1' (torch.nn.Module or None expected)
I’ve tried to cast the tensor as a Parameter using nn.Parameter() leading to the same error message.
The next option would be to create a custom Module just to cast the tensor from torch.concat() to the type nn.Module, but there is probably a better way.
I don’t fully understand the use case as a tensor cannot be used or transformed to an nn.Module.
Could you describe the use case a bit more and how the tensor should be used?
self.combined is a single tensor which is passed to an nn.ReLU and should work.
However, I guess you are trying to assign the output to self.l1 which seems to be an nn.Module and which is wrong.