I have a list of sentences and I am convert the list to a 3d tensor. The first dimension represents number of sentences, second dimension represents number of words and third dimension represents word embedding size.
The problem is, number of words can vary in sentences. I tried to create a 3d tensor as follows.
all_sentences1 = torch.FloatTensor(len(instances), None, args.emsize)
But this gives me the following error.
TypeError: torch.FloatTensor constructor received an invalid combination of arguments - got (int, NoneType, int), but expected one of:
* no arguments
* (int ...)
didn't match because some of the arguments have invalid types: (int, NoneType, int)
* (torch.FloatTensor viewed_tensor)
* (torch.Size size)
* (torch.FloatStorage data)
* (Sequence data)
How can I declare a 3d tensor?